diff --git a/README.en.md b/README.en.md index 1e663ae..71bb97f 100644 --- a/README.en.md +++ b/README.en.md @@ -132,7 +132,7 @@ build\tucker.exe --son | `--echelle N` | window scale (default 3: 960×720) | | `--plein` | starts fullscreen | | `--filtre NAME` | `nearest`, `smooth`, `xbr` or `crt` | -| `--sans-mods`, `--sans-hd` | no mods, no HD backgrounds | +| `--sans-mods`, `--sans-hd` | no mods, no HD pack | | `-v` | verbose log | **F11** or **Alt+Enter**: toggle fullscreen. **F12**: settings menu. All options and settings diff --git a/README.md b/README.md index 5e3d3bd..2b94691 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ build\tucker.exe --son | `--echelle N` | taille de la fenêtre (défaut 3 : 960×720) | | `--plein` | démarre en plein écran | | `--filtre NOM` | `nearest`, `smooth`, `xbr` ou `crt` | -| `--sans-mods`, `--sans-hd` | sans mods, sans décors HD | +| `--sans-mods`, `--sans-hd` | sans mods, sans pack HD | | `-v` | journal détaillé | **F11** ou **Alt+Entrée** : plein écran. **F12** : menu des réglages. Toutes les options et diff --git a/docs/GUIDE.en.md b/docs/GUIDE.en.md index 4695819..e3d185d 100644 --- a/docs/GUIDE.en.md +++ b/docs/GUIDE.en.md @@ -58,7 +58,7 @@ otherwise. | **Python 3.12** | Runs the x86 → C translator (`tools/recomp.py`). | [python.org/downloads](https://www.python.org/downloads/) | | **Rust** | Builds the launcher. | [rustup.rs](https://rustup.rs/) (`rustup-init.exe`) | | **Git** *(optional)* | To get the project and update it. | [git-scm.com](https://git-scm.com/download/win) | -| **Upscayl** *(optional)* | To create the HD background pack in one click. Not bundled with the project: install it if you want the HD pack ([details](TEXTURES.en.md#1-install-upscayl)). | [upscayl.org](https://upscayl.org) | +| **Upscayl** *(optional)* | To create the HD pack (backgrounds, characters and objects) in one click. Not bundled with the project: install it if you want the HD pack ([details](TEXTURES.en.md#1-install-upscayl)). | [upscayl.org](https://upscayl.org) | Watch out for: @@ -215,7 +215,7 @@ Main options (the option names are French; full list in [SETTINGS.en.md](SETTING | `--charger N` | starts on save `SAVEGM.N` (depending on the engine version, see section 11) | | `--plein`, `--fenetre`, `--echelle N` | full screen, window, ×N size | | `--filtre nearest\|smooth\|xbr\|crt` | picture filter | -| `--sans-mods`, `--sans-hd` | no mods, no HD backgrounds | +| `--sans-mods`, `--sans-hd` | no mods, no HD pack | | `-v` | verbose log | Display options only apply to the session; lasting settings live in `settings.ini`. @@ -224,7 +224,7 @@ Display options only apply to the session; lasting settings live in `settings.in | Key | Effect | |---|---| -| **F12** | settings menu: volumes, full screen, size, filter, 4:3, sync, HD backgrounds, quit the game | +| **F12** | settings menu: volumes, full screen, size, filter, 4:3, sync, HD pack (backgrounds, characters and objects), quit the game | | **Esc** | closes the F12 menu (otherwise, the original game's key) | | **F11** or **Alt+Enter** | full screen / window | | Mouse | as in the original game: verbs at the bottom, click to act | @@ -257,8 +257,9 @@ The game always draws its picture at 320×200; the graphics card then scales it > 🎨 **Full tutorial: [HD textures](TEXTURES.en.md)**: install Upscayl, export the backgrounds, > upscale them with the tool of your choice, retouch them by hand, troubleshooting. -The HD pack replaces the room backgrounds (320×200) on screen with high-definition pictures. -Characters, objects, texts and the cursor stay the game's own, drawn on top. The pictures are made +The HD pack replaces the room backgrounds (320×200) on screen with high-definition pictures, and, if +the pack has them, Bud, the characters, the objects and the cursor ([HD sprites](TEXTURES.en.md#i-hd-characters-and-objects-sprites)). +Texts and the action panel stay the game's own. The pictures are made **on your PC from your copy**: nothing is downloaded or distributed.

Mods & HD backgrounds card

@@ -268,9 +269,13 @@ Characters, objects, texts and the cursor stay the game's own, drawn on top. The 1. Install [Upscayl](https://upscayl.org) ([step by step](TEXTURES.en.md#1-install-upscayl)). While it's missing, the launcher shows a yellow "Upscayl is not installed" box. 2. In the launcher, **Mods & HD backgrounds** card, "Create an HD pack with Upscayl": pick a model, - then **Create pack**. The 122 backgrounds are upscaled ×4 in a few minutes, into - `mods\hd_upscayl` (or `mods\hd_upscayl_`). -3. Make sure **Enable mods** and **HD backgrounds** are ticked, then play. + keep **Backgrounds** and **Characters and objects** ticked, then **Create pack**. The 122 + backgrounds are upscaled ×4 in a few minutes; the characters and objects (several thousand + images) take much longer. Everything goes into `mods\hd_upscayl` (or `mods\hd_upscayl_`), + with **one model for the whole pack**. For an existing background pack: **+ HD sprites** button + on its line. +3. Make sure **Enable mods**, **HD pack**, **Backgrounds** and **Characters and objects** are ticked, + then play. Each box can be turned off separately, in game too with F12. Models give different looks; you can create several and switch with each mod's checkbox: @@ -311,7 +316,7 @@ A mod is a folder in `mods\` at the project root: mods\ my_mod\ mod.ini name, author, description (shown by the launcher) - hd\ HD backgrounds (LOC01.png…) + hd\ HD backgrounds (LOC01.png…), HD sprites (SHEETS\, SPRITES\) files\ replaced game files (same name and path as on the CD) ``` @@ -319,7 +324,7 @@ mods\ to set the order. - A folder whose name starts with `_` or `.` is ignored. - In the launcher, each mod has its checkbox; **Enable mods** turns them all off. Mod changes take - effect at the next launch; "HD backgrounds" can also be toggled in game with F12. + effect at the next launch; the HD pack can also be set in game with F12. `mod.ini`: @@ -390,7 +395,7 @@ Roadmap: [ROADMAP.en.md](ROADMAP.en.md). | **No sound** | Tick **Sound** in the launcher (`--son` option) and check the volumes (F12). | | **Black screen or the game does not open** | Update the graphics driver (OpenGL 3.3 required). Tick **Verbose log** and relaunch: the launcher log shows the cause. | | **"game exited, code 0"** | That is a normal exit (you quit the game). | -| **No HD backgrounds** | Check **Enable mods**, **HD backgrounds** and the mod's checkbox; the **CRT** filter always shows the original backgrounds. | +| **No HD backgrounds** | Check **Enable mods**, **HD pack**, **Backgrounds** and the mod's checkbox; the **CRT** filter always shows the original backgrounds. | | **Picture too small / too big** | Window size in the launcher or F12, or full screen (F11). | | **Odd settings** | Delete `%APPDATA%\DoubleTroubleRecomp\settings.ini`: the game starts again from the defaults. | diff --git a/docs/GUIDE.md b/docs/GUIDE.md index 88a03b4..5920d9d 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -58,7 +58,7 @@ défaut sauf mention contraire. | **Python 3.12** | Lance le traducteur x86 → C (`tools/recomp.py`). | [python.org/downloads](https://www.python.org/downloads/) | | **Rust** | Pour compiler le launcher. | [rustup.rs](https://rustup.rs/) (`rustup-init.exe`) | | **Git** *(facultatif)* | Pour récupérer le projet et le mettre à jour. | [git-scm.com](https://git-scm.com/download/win) | -| **Upscayl** *(facultatif)* | Pour créer le pack HD des décors en un clic. Pas fourni avec le projet : installez-le si vous voulez le pack HD ([détails](TEXTURES.md#1-installer-upscayl)). | [upscayl.org](https://upscayl.org) | +| **Upscayl** *(facultatif)* | Pour créer le pack HD (décors, personnages et objets) en un clic. Pas fourni avec le projet : installez-le si vous voulez le pack HD ([détails](TEXTURES.md#1-installer-upscayl)). | [upscayl.org](https://upscayl.org) | Points d'attention : @@ -220,7 +220,7 @@ Options principales (liste complète dans [SETTINGS.md](SETTINGS.md)) : | `--charger N` | démarre sur la sauvegarde `SAVEGM.N` (selon la version du moteur, voir section 11) | | `--plein`, `--fenetre`, `--echelle N` | plein écran, fenêtre, taille ×N | | `--filtre nearest\|smooth\|xbr\|crt` | filtre d'image | -| `--sans-mods`, `--sans-hd` | sans mods, sans décors HD | +| `--sans-mods`, `--sans-hd` | sans mods, sans pack HD | | `-v` | journal détaillé | Les options d'affichage ne valent que pour la session ; les réglages durables sont dans @@ -230,7 +230,7 @@ Les options d'affichage ne valent que pour la session ; les réglages durables s | Touche | Effet | |---|---| -| **F12** | menu des réglages : volumes, plein écran, taille, filtre, 4:3, synchro, décors HD, « Quitter le jeu » | +| **F12** | menu des réglages : volumes, plein écran, taille, filtre, 4:3, synchro, pack HD (décors, personnages et objets), « Quitter le jeu » | | **Échap** | ferme le menu F12 (sinon, touche du jeu d'origine) | | **F11** ou **Alt+Entrée** | plein écran / fenêtre | | Souris | comme dans le jeu d'origine : verbes en bas, clic pour agir | @@ -263,8 +263,9 @@ Le jeu calcule toujours son image en 320×200, puis la carte graphique l'agrandi > 🎨 **Tutoriel complet : [Textures HD](TEXTURES.md)** : installer Upscayl, exporter les décors, > les agrandir avec l'outil de votre choix, les retoucher à la main, dépannage. -Le pack HD remplace à l'écran les décors des pièces (320×200) par des images haute définition. Les -personnages, objets, textes et le curseur restent ceux du jeu, posés par-dessus. Les images sont +Le pack HD remplace à l'écran les décors des pièces (320×200) par des images haute définition, et, si +le pack les contient, Bud, les personnages, les objets et le curseur ([sprites HD](TEXTURES.md#i-personnages-et-objets-hd-sprites)). +Les textes et le panneau d'actions restent ceux du jeu. Les images sont créées **sur votre PC à partir de votre copie** : rien n'est téléchargé ni distribué.

Carte Mods et décors HD

@@ -274,9 +275,13 @@ créées **sur votre PC à partir de votre copie** : rien n'est téléchargé ni 1. Installez [Upscayl](https://upscayl.org) ([pas à pas](TEXTURES.md#1-installer-upscayl)). Tant qu'il manque, le launcher affiche un encadré jaune « Upscayl n'est pas installé ». 2. Dans le launcher, carte **Mods et décors HD**, section « Créer un pack HD avec Upscayl » : - choisissez un modèle, puis **Créer le pack**. Les 122 décors sont agrandis ×4 en quelques - minutes, dans `mods\hd_upscayl` (ou `mods\hd_upscayl_`). -3. Vérifiez que **Activer les mods** et **Décors HD** sont cochés, puis jouez. + choisissez un modèle, gardez **Décors** et **Personnages et objets** cochés, puis **Créer le pack**. + Les 122 décors sont agrandis ×4 en quelques minutes ; les personnages et objets (plusieurs + milliers d'images) prennent nettement plus longtemps. Le tout va dans `mods\hd_upscayl` (ou + `mods\hd_upscayl_`), avec **un seul modèle pour tout le pack**. + Pour un pack de décors déjà fait : bouton **+ sprites HD** sur sa ligne. +3. Vérifiez que **Activer les mods**, **Pack HD**, **Décors** et **Personnages et objets** sont + cochés, puis jouez. Chaque case se coupe à part, aussi en jeu avec F12. Les modèles donnent des rendus différents ; vous pouvez en créer plusieurs et basculer avec les cases de chaque mod : @@ -318,7 +323,7 @@ Un mod est un dossier dans `mods\` à la racine du projet : mods\ mon_mod\ mod.ini nom, auteur, description (affichés par le launcher) - hd\ décors HD (LOC01.png…) + hd\ décors HD (LOC01.png…), sprites HD (SHEETS\, SPRITES\) files\ fichiers du jeu remplacés (même nom et même chemin que sur le CD) ``` @@ -326,7 +331,7 @@ mods\ Préfixez par `10_`, `20_` pour fixer l'ordre. - Un dossier qui commence par `_` ou `.` est ignoré. - Dans le launcher, chaque mod a sa case ; **Activer les mods** les coupe tous. Les changements de - mods prennent effet au lancement suivant ; « Décors HD » se change aussi en jeu avec F12. + mods prennent effet au lancement suivant ; le pack HD se règle aussi en jeu avec F12. `mod.ini` : @@ -401,7 +406,7 @@ Feuille de route : [ROADMAP.md](ROADMAP.md). | **Pas de son** | Cochez **Son** dans le launcher (option `--son`) et vérifiez les volumes (F12). | | **Écran noir ou le jeu ne s'ouvre pas** | Mettez à jour le pilote graphique (OpenGL 3.3 requis). Cochez **Journal détaillé** et relancez : le journal du launcher montre la cause. | | **« jeu terminé, code 0 »** | C'est une sortie normale (vous avez quitté le jeu). | -| **Pas de décors HD** | Vérifiez **Activer les mods**, **Décors HD** et la case du mod ; le filtre **CRT** affiche toujours les décors d'origine. | +| **Pas de décors HD** | Vérifiez **Activer les mods**, **Pack HD**, **Décors** et la case du mod ; le filtre **CRT** affiche toujours les décors d'origine. | | **Image trop petite / trop grande** | Taille de la fenêtre dans le launcher ou F12, ou plein écran (F11). | | **Réglages bizarres** | Supprimez `%APPDATA%\DoubleTroubleRecomp\settings.ini` : le jeu repart des valeurs par défaut. | diff --git a/docs/MODS.en.md b/docs/MODS.en.md index 5ed288f..4d6d223 100644 --- a/docs/MODS.en.md +++ b/docs/MODS.en.md @@ -21,6 +21,8 @@ mods/ LOC01.png HD background for LOC01.PCX LOC03A.png room in several pieces: one PNG per piece LOC03B.png + SHEETS/BUD_1.png HD sprite sheet (characters, objects, cursor) + SPRITES/A01_04.png HD sprites of an SPR file voix_fr/ files/ SPEECH/SAM0001.WAV replaces the game file with the same path @@ -29,7 +31,7 @@ mods/ - `files/`: each file replaces the game file with the same relative path. Case does not matter. Any file the game opens for reading can be replaced: images, sounds, texts, etc. - `hd/`: HD images of the backgrounds (see below). The name is that of the original PCX, with the - `.png` extension. + `.png` extension. `hd/SHEETS/` and `hd/SPRITES/`: HD sprites (see "HD sprites"). - Mods are applied in alphabetical order of their folder name. For the same file, **the last one wins**. Prefix them, for example `10_`, `20_`, to set the order. - A folder whose name starts with `_` or `.` is ignored, which lets you set a mod aside. @@ -58,8 +60,9 @@ description=Backgrounds upscaled ×4 with Real-ESRGAN ## HD pack The HD pack replaces the game's **backgrounds** on screen with high-definition images, at any -resolution. The game keeps running at 320×200: characters, animated objects, cursor, action panel and -texts remain the game's own and are laid over the HD background. +resolution, and, if the pack provides them, the **sprites**: characters, animated objects, cursor (see +"HD sprites"). The game keeps running at 320×200: the action panel, the texts and whatever the pack +does not provide remain the game's own and are laid on top. ### How it works @@ -74,8 +77,10 @@ texts remain the game's own and are laid over the HD background. The engine needs no knowledge of the game, and an incomplete pack works: a background without a PNG stays at 320×200. The `nearest`, `smooth` and `xbr` filters apply to the game layer. The `crt` filter -shows the original picture, without the HD pack. The "Décors HD (mods)" (HD backgrounds) option of the -F12 menu (key `hd_pack`) turns the pack on or off during play. +shows the original picture, without the HD pack. In the F12 menu, "Pack HD (mods)" (key `hd_pack`) turns +the whole pack on or off during play; below it, "Décors HD" (HD backgrounds, `hd_decors`) and +"Personnages et objets HD" (HD characters and objects, `hd_sprites`) turn off only part of it, for +example to keep the HD backgrounds with the original sprites. ### Rules for the images @@ -88,7 +93,7 @@ F12 menu (key `hd_pack`) turns the pack on or off during play. replaced PCX: a mod that redraws a background must also provide its HD PNG, or be used without the HD pack. - The areas where the game draws animated objects with their own background (clock, lamp…) stay in low - resolution: the game draws there itself. + resolution without HD sprites: the game draws there itself. ### Creating a pack with Upscayl @@ -117,11 +122,63 @@ This command exports the backgrounds as 320×200 PNGs. Upscale them with the too `--echelle 2` or `--echelle 4` (scale) directly produces a Scale2x upscale, without blur, to try a pack right away. `--motif` (pattern) selects the files (default `LOC*`). +## HD sprites + +Sprites (characters, objects, cursor) are drawn by the game from two kinds of images, which the engine +recognises at drawing time: + +- the **PCX sheets** cut up by the game (`BUD_1.PCX` to `BUD_6.PCX` for Bud, `SCROBJ*.PCX` for the + room objects, `POINTER.PCX` for the cursor…): HD image `hd/SHEETS/NAME.png`, same framing as the + 320×200 sheet (1280×800 for ×4); +- the **SPR files** (animations of the other characters, `A01_04.SPR`…): their frames are laid out in a + sheet whose layout is set by the engine, `hd/SPRITES/NAME.png` (and `NAME_P1.png`, `NAME_P2.png`… if + it spills over a 1024×1024 page). Only `hd_export.py` knows how to produce this layout. + +### How it works + +1. Each sprite drawn by the game is recorded with its sheet and its original rectangle. +2. On each frame, the engine looks, pixel by pixel, for the last sprite still visible: whatever was + drawn on top afterwards (foreground, another sprite, text) stays the game's. +3. The HD sprite is drawn over the HD background in place of the original sprite. Its colours follow + the game's palette at that moment: the object sheets serve every room of a part, each with its own + palette, and fades change the palette. The difference between the export palette and the game + palette is corrected per original index, and smoothed over the HD image. +4. An object drawn with its own background (opaque rectangle) gives back to the HD background the part + of that background that has the colour of the original background. +5. HD images are read and compressed (DXT5) by a loading thread: a sprite that appears is drawn in low + resolution while it loads (a few tens of milliseconds), without stutter. The least recently seen + sheets are freed beyond 48 MB of textures. + +A sprite without an HD image stays as the game drew it. An HD image whose size does not match the +export (other layout) is ignored, with an "à réexporter" (re-export) message in the log. + +### Creating the HD sprites + +``` +python tools/hd_export.py ..\extracted\iso\TUCKER mods\hd_upscayl\hd --sans-decors --planches --sprites --upscayl +``` + +- `--planches [PATTERN]` (sheets) exports the PCX sheets into `SHEETS/`. Default pattern: + `BUD_*,BUDL00_*,PEG_*,MAC_*,SCROBJ*,PANOBJS*,POINTER,CHARSET*,CHAR2,CLIO*,COGS*`. +- `--sprites [PATTERN]` exports the SPR files into `SPRITES/` (all by default). +- `--sans-decors` (no backgrounds) does not export the backgrounds (already done). +- Transparent pixels are exported with the colour of their neighbours, so that upscaling does not + create a dark fringe; the alpha channel keeps the transparency. +- Requires `numpy` (`pip install numpy`). +- **Use the same Upscayl model as for the backgrounds**, in the same mod: two different models do not + upscale colours the same way, and the objects' background would show as a rectangle over the + background. +- The object sheets have their own palette, different from the rooms': upscaling is done with this + palette, then corrected in game. The result is faithful for the colours, a little less so for the + outlines of objects whose palette differs a lot. + ## For the launcher - Listing the mods: subfolders of `mods/` whose name starts with neither `_` nor `.`, with `mod.ini` for the displayed name. A mod has HD backgrounds if it contains `hd/*.png`. - Enabling or disabling a mod: write the list into `[mods] disabled` in `settings.ini`. The list is taken into account on the next launch. -- HD pack on/off: `[display] hd_pack` key, also adjustable in game (F12). +- HD pack on/off: `[display] hd_pack` key, also adjustable in game (F12). Sub-settings: `hd_decors` + (HD backgrounds) and `hd_sprites` (HD characters and objects), no effect if `hd_pack=0`. +- A mod has HD sprites if it contains `hd/SHEETS/*.png` or `hd/SPRITES/*.png`. - Options for a single session: `--mods FOLDER`, `--sans-mods`, `--sans-hd`. diff --git a/docs/SETTINGS.en.md b/docs/SETTINGS.en.md index 56e4b6c..7b20c0a 100644 --- a/docs/SETTINGS.en.md +++ b/docs/SETTINGS.en.md @@ -39,6 +39,8 @@ filter=xbr aspect_43=1 vsync=0 hd_pack=1 +hd_decors=1 +hd_sprites=1 [audio] master_volume=100 @@ -63,7 +65,9 @@ disabled= | `filter` | `nearest`, `smooth`, `xbr`, `crt` | `nearest` | Picture filter (see below) | | `aspect_43` | `0` / `1` | `1` | `1`: 320×200 picture stretched to 4:3, as on a VGA monitor. `0`: square pixels (16:10) | | `vsync` | `0` / `1` | `0` | Vertical sync | -| `hd_pack` | `0` / `1` | `1` | HD backgrounds provided by mods (see [MODS.en.md](MODS.en.md)). No effect if no mod provides HD images, nor with the `crt` filter | +| `hd_pack` | `0` / `1` | `1` | HD pack provided by mods (see [MODS.en.md](MODS.en.md)): master switch for the next two keys. No effect if no mod provides HD images, nor with the `crt` filter | +| `hd_decors` | `0` / `1` | `1` | The pack's HD backgrounds | +| `hd_sprites` | `0` / `1` | `1` | The pack's HD characters, objects and cursor (sprites) | Filters: @@ -96,8 +100,8 @@ the ear. | `dir` | path | empty | Mods folder. Empty: `mods` next to the executable, otherwise `mods` in the parent folder (the case of `build\tucker.exe`), otherwise `mods` in the current folder | | `disabled` | comma-separated names | empty | Mods (folder names) to ignore, for example `disabled=hd_upscayl,voix_fr` | -Mods are read at startup: a change to `[mods]` takes effect on the next launch. `hd_pack`, however, -applies immediately from the F12 menu. The mod format is described in [MODS.en.md](MODS.en.md). +Mods are read at startup: a change to `[mods]` takes effect on the next launch. `hd_pack`, `hd_decors` and +`hd_sprites`, however, apply immediately from the F12 menu. The mod format is described in [MODS.en.md](MODS.en.md). ## Command line diff --git a/docs/TEXTURES.en.md b/docs/TEXTURES.en.md index adec4d1..8f84f57 100644 --- a/docs/TEXTURES.en.md +++ b/docs/TEXTURES.en.md @@ -2,8 +2,8 @@ 🇫🇷 [Français](TEXTURES.md) · 🇺🇸 **English** -This tutorial shows how to replace the game's backgrounds (320×200) with your own high-definition -images: automatically with Upscayl, or by hand with the tool of your choice (another AI, a painting +This tutorial shows how to replace the game's backgrounds (320×200), and its characters and objects +too ([section I](#i-hd-characters-and-objects-sprites)), with your own high-definition images: automatically with Upscayl, or by hand with the tool of your choice (another AI, a painting program, room-by-room retouching). The images are made **on your PC, from your own copy of the game**: the project downloads and distributes nothing. @@ -17,6 +17,7 @@ game**: the project downloads and distributes nothing. | To pick Upscayl's settings myself | [B. Export](#b-export-the-original-backgrounds), then [C. Upscayl by hand](#c-upscale-with-upscayl-by-hand) | 15 min | | To use another AI (chaiNNer, waifu2x, Topaz…) | [B](#b-export-the-original-backgrounds), then [D. Another tool](#d-upscale-with-another-tool) | varies | | To redraw or fix some rooms | [E. Retouch by hand](#e-retouch-by-hand) | your own pace | +| Bud, the characters and the objects in HD too | [I. HD characters and objects](#i-hd-characters-and-objects-sprites) | long | Contents: @@ -30,6 +31,7 @@ Contents: - [F. Put the images in a mod](#f-put-the-images-in-a-mod) - [G. Check in game](#g-check-in-game) - [H. Combine several packs](#h-combine-several-packs) +- [I. HD characters and objects (sprites)](#i-hd-characters-and-objects-sprites) - [The rules, in one table](#the-rules-in-one-table) - [Troubleshooting](#troubleshooting) - [Sharing your pack?](#sharing-your-pack) @@ -41,7 +43,7 @@ Contents: | Element | In HD? | |---|---| | **Room backgrounds** (`LOC01` to `LOC82`, 122 images) | ✅ yes, this is what the tutorial covers | -| Characters (Bud, Fester…), animated objects, cursor, inventory | 🚧 in development: they stay 320×200, drawn on top of the HD background | +| Characters (Bud, Fester…), animated objects, cursor, inventory | ✅ yes: [section I](#i-hd-characters-and-objects-sprites) | | Text, speech bubbles, action panel | ❌ no (they stay the game's own) | How it works, in one sentence: the game still runs at 320×200; on every frame, the engine finds the @@ -105,12 +107,14 @@ Upscayl won't work, but you can: 1. Install Upscayl ([section 1](#1-install-upscayl)). 2. Launcher → **Mods & HD backgrounds** card → "Create an HD pack with Upscayl". -3. Pick a **model** (see the table), then **Create pack**. +3. Pick a **model** (see the table). Leave **Backgrounds** ticked; also tick **Characters and + objects** for HD sprites (much longer, see [section I](#i-hd-characters-and-objects-sprites)). Then **Create pack**. 4. Wait: a few seconds to a few minutes depending on the graphics card. The log (**Log** button, at the bottom) shows progress. 5. The pack appears in the mod list: `hd_upscayl` for the default model, `hd_upscayl_` for the others. -6. Make sure **Enable mods** and **HD backgrounds** are ticked, then **PLAY**. +6. Make sure **Enable mods**, **HD pack** and **Backgrounds** (and **Characters and objects**) are + ticked, then **PLAY**.

Launcher's Mods & HD backgrounds card

@@ -280,12 +284,13 @@ without deleting it). ## G. Check in game -1. Launcher: **Refresh**, then check that your mod is ticked, along with **Enable mods** and **HD - backgrounds**. +1. Launcher: **Refresh**, then check that your mod is ticked, along with **Enable mods**, **HD + pack** and **Backgrounds**. 2. **Welcome to Barryville** card (the preview): it shows a room with your pack, using the same filters as the game. -3. **PLAY**. In game, **F12** opens the settings: "HD backgrounds" turns the pack on or off, to - compare with the original in the same room. +3. **PLAY**. In game, **F12** opens the settings: "Pack HD (mods)" turns the whole pack on or off, + "Décors HD" (backgrounds) and "Personnages et objets HD" (characters and objects) only part of it: + handy to compare with the original in the same room. 4. To see what the engine found, tick **Verbose log** before playing, then open the **Log**: a line like `[mods] 0 fichier(s) remplacé(s), 122 image(s) HD` sums up what was loaded. @@ -302,6 +307,52 @@ The **CRT** filter always shows the original image (it simulates a 1996 screen): retouched rooms come from `20_…`, all the others from `10_…`. - To compare two full packs, tick only one at a time. +## I. HD characters and objects (sprites) + +The pack can also contain **Bud, the other characters, the objects and the cursor** in HD. The engine +recognises them when the game draws them, and gives them the game's colours on every frame: fades, +night, each room's own palette. + +**With the launcher:** + +- **New pack**: next to the model, leave **Backgrounds** and **Characters and objects** ticked, then + **Create pack**. +- **Existing background pack**: on its line, click **+ HD sprites** (or **Complete the HD sprites** if + some are missing). The launcher reuses **that pack's model**. +- It takes **much longer** than the backgrounds: several thousand images (about 55 million pixels); + the time depends mostly on the graphics card. The game stays playable + meanwhile with what is already done: a sprite without an HD image stays the game's own. + +> ⚠️ **One model per pack.** Two Upscayl models don't upscale colours the same way: an object upscaled +> with `digital-art-4x` on top of an `ultramix-balanced-4x` background would show, with a rectangle +> around it. The launcher always puts backgrounds and sprites of the same model in the same mod; by +> hand, do the same. + +**From the command line** (needs `numpy`: `pip install numpy`): + +```powershell +python tools\hd_export.py GAME_PATH mods\hd_upscayl\hd --sans-decors --planches --sprites --upscayl digital-art-4x +``` + +- `--planches` (sheets): the PCX sheets (Bud, room objects, inventory icons, cursor); +- `--sprites`: the `.SPR` files (character animations). To try a single room first: + `--sprites A01_*`; +- `--sans-decors` (no backgrounds): does not redo the backgrounds. + +**Where the images go, and what you can retouch:** + +| Folder | Contents | Retouching by hand | +|---|---|---| +| `hd\SHEETS\BUD_1.png`… | sheets cut up by the game, same framing as the 320×200 sheet (1280×800 at ×4) | yes, like a background: same size, and keep the transparency (alpha channel) | +| `hd\SPRITES\A01_04.png`… | frames of a `.SPR` file, laid out the way the engine expects | only without moving or resizing anything; an image of the wrong size is ignored ("à réexporter", re-export, in the log) | + +**Turn off HD sprites but keep HD backgrounds**: launcher, **Characters and objects** box under +**HD pack**; or in game, **F12** → "Personnages et objets HD" (HD characters and objects). + +Known limits: the bedroom's ceiling lamp keeps a faint rectangle (the original background has a hole +there, which the game fills); the outlines of some objects are slightly less fine than the +backgrounds', because the object sheet has its own palette. + --- ## The rules, in one table @@ -324,12 +375,13 @@ The **CRT** filter always shows the original image (it simulates a 1996 screen): |---|---| | The launcher says "Upscayl is not installed" but it is | Click **Refresh**. Otherwise Upscayl is in a non-standard place: `UPSCAYL_BIN` variable ([section 1](#1-install-upscayl)). | | The pack is created but stays empty / Vulkan error in the log | Update your graphics driver; open Upscayl on its own to check that it works. On a laptop with two GPUs, pick the dedicated one in Upscayl's settings. | -| My image doesn't show in game | Exact name (`LOC01.png`, not `LOC01_upscayl…png`); `mods\\hd\` folder; mod ticked; **HD backgrounds** ticked; a filter other than CRT; 16:10 image. | +| My image doesn't show in game | Exact name (`LOC01.png`, not `LOC01_upscayl…png`); `mods\\hd\` folder; mod ticked; **HD pack** and **Backgrounds** ticked; a filter other than CRT; 16:10 image. | | The image is offset or "bleeds" around characters | The framing changed (crop, border, ratio). Start again from the export and keep the whole image. | | A vertical seam in the middle of a scrolling room | The `A`/`B`… pieces weren't processed the same way; redo them with the same tool and size. | -| Some areas stay pixelated | Normal: the game draws there (animated object, character). HD sprites are in development. | +| Characters and objects stay pixelated | The pack doesn't have HD sprites (yet): **+ HD sprites** button on its line ([section I](#i-hd-characters-and-objects-sprites)); check **Characters and objects**. Text and the action panel always stay the game's own. | +| A rectangle or a different tint around an object | Backgrounds and sprites made with two different models: redo the sprites with the backgrounds' model, in the same mod. | | Rooms load slowly, the game uses a lot of memory | Images beyond 2560×1600 cost memory with no visible gain: stay at ×4 (1280×800) or ×8. | -| I want the original back | Untick **HD backgrounds** (or F12 in game); or rename the mod folder with a leading `_`. | +| I want the original back | Untick **HD pack** (or F12 in game); or rename the mod folder with a leading `_`. | For everything else: [complete guide, Troubleshooting](GUIDE.en.md#13-troubleshooting) and [mod technical details](MODS.en.md). diff --git a/docs/TEXTURES.md b/docs/TEXTURES.md index b6868f6..b26978c 100644 --- a/docs/TEXTURES.md +++ b/docs/TEXTURES.md @@ -2,8 +2,8 @@ 🇫🇷 **Français** · 🇺🇸 [English](TEXTURES.en.md) -Ce tutoriel explique comment remplacer les décors du jeu (320×200) par vos propres images haute -définition : automatiquement avec Upscayl, ou à la main avec l'outil de votre choix (autre IA, +Ce tutoriel explique comment remplacer les décors du jeu (320×200), et aussi ses personnages et objets +([section I](#i-personnages-et-objets-hd-sprites)), par vos propres images haute définition : automatiquement avec Upscayl, ou à la main avec l'outil de votre choix (autre IA, logiciel de dessin, retouche pièce par pièce). Les images sont créées **sur votre PC, à partir de votre copie du jeu** : rien n'est téléchargé ni distribué par le projet. @@ -17,6 +17,7 @@ votre copie du jeu** : rien n'est téléchargé ni distribué par le projet. | Choisir moi-même l'outil ou les réglages d'Upscayl | [B. Exporter](#b-exporter-les-décors-dorigine) puis [C. Upscayl à la main](#c-agrandir-avec-upscayl-à-la-main) | 15 min | | Utiliser une autre IA (chaiNNer, waifu2x, Topaz…) | [B](#b-exporter-les-décors-dorigine) puis [D. Autre outil](#d-agrandir-avec-un-autre-outil) | variable | | Redessiner ou corriger certaines pièces | [E. Retoucher à la main](#e-retoucher-à-la-main) | à votre rythme | +| Bud, les personnages et les objets en HD aussi | [I. Personnages et objets HD](#i-personnages-et-objets-hd-sprites) | long | Sommaire : @@ -30,6 +31,7 @@ Sommaire : - [F. Ranger les images dans un mod](#f-ranger-les-images-dans-un-mod) - [G. Vérifier en jeu](#g-vérifier-en-jeu) - [H. Combiner plusieurs packs](#h-combiner-plusieurs-packs) +- [I. Personnages et objets HD (sprites)](#i-personnages-et-objets-hd-sprites) - [Les règles, en un tableau](#les-règles-en-un-tableau) - [Dépannage](#dépannage) - [Partager son pack ?](#partager-son-pack-) @@ -41,7 +43,7 @@ Sommaire : | Élément | En HD ? | |---|---| | **Décors des pièces** (`LOC01` à `LOC82`, 122 images) | ✅ oui, c'est l'objet de ce tutoriel | -| Personnages (Bud, Fester…), objets animés, curseur, inventaire | 🚧 en cours de développement : ils restent en 320×200, posés par-dessus le décor HD | +| Personnages (Bud, Fester…), objets animés, curseur, inventaire | ✅ oui : [section I](#i-personnages-et-objets-hd-sprites) | | Textes, bulles de dialogue, panneau d'actions | ❌ non (restent ceux du jeu) | Comment ça marche, en une phrase : le jeu tourne toujours en 320×200 ; à chaque image, le moteur @@ -107,12 +109,14 @@ Upscayl ne marchera pas, mais vous pouvez : 1. Installez Upscayl ([section 1](#1-installer-upscayl)). 2. Launcher → carte **Mods et décors HD** → « Créer un pack HD avec Upscayl ». -3. Choisissez un **modèle** (voir le tableau), puis **Créer le pack**. +3. Choisissez un **modèle** (voir le tableau). Laissez **Décors** coché ; cochez aussi **Personnages et + objets** pour les sprites HD (beaucoup plus long, voir [section I](#i-personnages-et-objets-hd-sprites)). Puis **Créer le pack**. 4. Patientez : de quelques secondes à quelques minutes selon la carte graphique. Le journal (bouton **Journal**, en bas) montre l'avancement. 5. Le pack apparaît dans la liste des mods : `hd_upscayl` pour le modèle par défaut, `hd_upscayl_` pour les autres. -6. Vérifiez que **Activer les mods** et **Décors HD** sont cochés, puis **JOUER**. +6. Vérifiez que **Activer les mods**, **Pack HD** et **Décors** (et **Personnages et objets**) sont + cochés, puis **JOUER**.

Carte Mods et décors HD du launcher

@@ -282,12 +286,13 @@ pack de côté sans le supprimer). ## G. Vérifier en jeu -1. Launcher : **Actualiser**, puis vérifiez que votre mod est coché, ainsi que **Activer les mods** - et **Décors HD**. +1. Launcher : **Actualiser**, puis vérifiez que votre mod est coché, ainsi que **Activer les mods**, + **Pack HD** et **Décors**. 2. Carte **Bienvenue à Barryville** (l'aperçu) : elle affiche une pièce avec votre pack, avec les mêmes filtres que le jeu. -3. **JOUER**. En jeu, **F12** ouvre les réglages : « Décors HD » active ou coupe le pack, pour - comparer avec l'original sur la même pièce. +3. **JOUER**. En jeu, **F12** ouvre les réglages : « Pack HD (mods) » active ou coupe tout le pack, + « Décors HD » et « Personnages et objets HD » une partie seulement : pratique pour comparer avec + l'original sur la même pièce. 4. Pour voir ce que le moteur a trouvé, cochez **Journal détaillé** avant de jouer, puis ouvrez le **Journal** : une ligne du type `[mods] 0 fichier(s) remplacé(s), 122 image(s) HD` résume le chargement. @@ -305,6 +310,52 @@ Le filtre **CRT** affiche toujours l'image d'origine (il simule un écran de 199 seulement). Les pièces retouchées viennent de `20_…`, toutes les autres de `10_…`. - Pour comparer deux packs complets, n'en cochez qu'un à la fois. +## I. Personnages et objets HD (sprites) + +Le pack peut aussi contenir **Bud, les autres personnages, les objets et le curseur** en HD. Le moteur +les reconnaît au moment où le jeu les dessine, et leur donne à chaque image les couleurs du jeu : +fondus, nuit, palette propre à chaque pièce. + +**Avec le launcher :** + +- **Nouveau pack** : à côté du modèle, laissez cochés **Décors** et **Personnages et objets**, puis + **Créer le pack**. +- **Pack de décors déjà fait** : sur sa ligne, cliquez **+ sprites HD** (ou **Compléter les sprites + HD** s'il en manque). Le launcher reprend **le modèle de ce pack**. +- C'est **bien plus long** que les décors : plusieurs milliers d'images (environ 55 millions de + pixels), la durée dépend surtout de la carte graphique. Le jeu reste + jouable pendant ce temps avec ce qui est déjà fait : un sprite sans image HD reste celui du jeu. + +> ⚠️ **Un seul modèle par pack.** Deux modèles Upscayl n'agrandissent pas les couleurs de la même +> façon : un objet agrandi avec `digital-art-4x` posé sur un décor `ultramix-balanced-4x` se verrait, +> avec un rectangle autour. Le launcher met toujours décors et sprites du même modèle dans le même +> mod ; à la main, faites pareil. + +**En ligne de commande** (il faut `numpy` : `pip install numpy`) : + +```powershell +python tools\hd_export.py CHEMIN_DU_JEU mods\hd_upscayl\hd --sans-decors --planches --sprites --upscayl digital-art-4x +``` + +- `--planches` : les planches PCX (Bud, objets des pièces, icônes d'inventaire, curseur) ; +- `--sprites` : les fichiers `.SPR` (animations des personnages). Pour essayer sur une seule pièce + d'abord : `--sprites A01_*` ; +- `--sans-decors` : ne refait pas les décors. + +**Où vont les images, et ce qu'on peut retoucher :** + +| Dossier | Contenu | Retouche à la main | +|---|---|---| +| `hd\SHEETS\BUD_1.png`… | planches découpées par le jeu, même cadrage que la planche 320×200 (1280×800 en ×4) | oui, comme un décor : même taille, et garder la transparence (canal alpha) | +| `hd\SPRITES\A01_04.png`… | images d'un fichier `.SPR`, rangées selon une mise en page propre au moteur | seulement sans rien déplacer ni redimensionner ; une image de mauvaise taille est ignorée (« à réexporter » dans le journal) | + +**Couper les sprites HD sans couper les décors** : launcher, case **Personnages et objets** sous +**Pack HD** ; ou en jeu, **F12** → « Personnages et objets HD ». + +Limites connues : la lampe du plafond de la chambre garde un léger rectangle (le décor d'origine a +un trou à cet endroit, que le jeu remplit) ; les contours de certains objets sont un peu moins fins +que ceux des décors, parce que la planche d'objets a sa propre palette. + --- ## Les règles, en un tableau @@ -327,12 +378,13 @@ Le filtre **CRT** affiche toujours l'image d'origine (il simule un écran de 199 |---|---| | Le launcher affiche « Upscayl n'est pas installé » alors qu'il l'est | Cliquez **Actualiser**. Sinon Upscayl est à un emplacement non standard : variable `UPSCAYL_BIN` ([section 1](#1-installer-upscayl)). | | Le pack se crée mais reste vide / erreur Vulkan dans le journal | Mettez à jour le pilote de la carte graphique ; ouvrez Upscayl seul pour vérifier qu'il fonctionne. Sur un PC portable à deux cartes, choisissez la carte dédiée dans les réglages d'Upscayl. | -| Mon image n'apparaît pas en jeu | Nom exact (`LOC01.png`, pas `LOC01_upscayl…png`) ; dossier `mods\\hd\` ; mod coché ; **Décors HD** coché ; filtre autre que CRT ; image en 16:10. | +| Mon image n'apparaît pas en jeu | Nom exact (`LOC01.png`, pas `LOC01_upscayl…png`) ; dossier `mods\\hd\` ; mod coché ; **Pack HD** et **Décors** cochés ; filtre autre que CRT ; image en 16:10. | | L'image est décalée ou « bave » autour des personnages | Le cadrage a changé (recadrage, bordure, ratio). Repartez de l'export et gardez l'image entière. | | Une couture verticale au milieu d'une pièce qui défile | Les morceaux `A`/`B`… n'ont pas été traités pareil ; refaites-les avec le même outil et la même taille. | -| Quelques zones restent pixelisées | Normal : là, c'est le jeu qui dessine (objet animé, personnage). Les sprites HD sont en cours de développement. | +| Personnages et objets restent pixelisés | Le pack n'a pas (encore) les sprites HD : bouton **+ sprites HD** sur sa ligne ([section I](#i-personnages-et-objets-hd-sprites)) ; vérifiez **Personnages et objets**. Textes et panneau d'actions restent toujours ceux du jeu. | +| Un rectangle ou une teinte différente autour d'un objet | Décors et sprites faits avec deux modèles différents : refaites les sprites avec le modèle des décors, dans le même mod. | | Le chargement des pièces est lent, le jeu prend beaucoup de mémoire | Les images au-delà de 2560×1600 coûtent de la mémoire sans gain visible : restez en ×4 (1280×800) ou ×8. | -| Je veux revenir à l'original | Décochez **Décors HD** (ou F12 en jeu) ; ou renommez le dossier du mod avec un `_` devant. | +| Je veux revenir à l'original | Décochez **Pack HD** (ou F12 en jeu) ; ou renommez le dossier du mod avec un `_` devant. | Pour tout le reste : [guide complet, section Dépannage](GUIDE.md#13-dépannage) et [détails techniques des mods](MODS.md). diff --git a/docs/images/launcher-en-carte-mods.jpg b/docs/images/launcher-en-carte-mods.jpg index 5550327..d886515 100644 Binary files a/docs/images/launcher-en-carte-mods.jpg and b/docs/images/launcher-en-carte-mods.jpg differ diff --git a/docs/images/launcher-fr-carte-mods.jpg b/docs/images/launcher-fr-carte-mods.jpg index ef989e4..bdeb120 100644 Binary files a/docs/images/launcher-fr-carte-mods.jpg and b/docs/images/launcher-fr-carte-mods.jpg differ diff --git a/launcher/src/main.rs b/launcher/src/main.rs index 86932ee..255ab6d 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -612,6 +612,9 @@ struct App { upscayl_models: Vec, upscayl_model: String, new_mod_name: String, + /// contenu du pack HD à créer + pack_decors: bool, + pack_sprites: bool, mod_msg: Option<(bool, String)>, /// dossier à ouvrir quand la tâche en cours réussit open_after: Option, @@ -676,6 +679,8 @@ impl App { upscayl_models: Vec::new(), upscayl_model: mods::DEFAULT_MODEL.to_string(), new_mod_name: String::new(), + pack_decors: true, + pack_sprites: true, mod_msg: None, open_after: None, art: Art::default(), @@ -750,9 +755,9 @@ impl App { self.art.hd_key.clear(); } - /// décors HD à charger : mods actifs et décors HD activés + /// décors HD à charger : mods actifs, pack HD et décors HD activés fn hd_active(&self) -> bool { - self.gs.mods_enabled && self.gs.hd_pack + self.gs.mods_enabled && self.gs.hd_pack && self.gs.hd_decors } /// visibles en jeu : le filtre CRT affiche toujours les décors d'origine @@ -799,17 +804,27 @@ impl App { .collect(); } - fn create_hd_pack(&mut self) { + /// crée ou complète un pack Upscayl : décors et/ou sprites (planches PCX + fichiers SPR), avec un seul + /// modèle pour tout le pack (deux modèles n'agrandissent pas les couleurs pareil : voir docs/MODS.md) + fn create_hd_pack(&mut self, target: Option, model: String, decors: bool, sprites: bool) { let (Some(game), Some(mdir)) = (self.checks.game_dir.clone(), self.mods_dir()) else { return }; - let id = mods::pack_id(&self.upscayl_model); - let target = mdir.join(&id); - mods::write_mod_ini(&target, &self.upscayl_model); + if !decors && !sprites { + return; + } + let target = target.unwrap_or_else(|| mdir.join(mods::pack_id(&model))); + mods::write_mod_ini(&target, &model); let mut cmd = format!( - "python -I tools\\hd_export.py \"{}\" \"{}\" --upscayl {}", + "python -I tools\\hd_export.py \"{}\" \"{}\"", game.display(), - target.join("hd").display(), - self.upscayl_model + target.join("hd").display() ); + if !decors { + cmd.push_str(" --sans-decors"); + } + if sprites { + cmd.push_str(" --planches --sprites"); + } + cmd.push_str(&format!(" --upscayl {model}")); if let Some(bin) = &self.upscayl { cmd.push_str(&format!(" --upscayl-bin \"{}\"", bin.display())); } @@ -825,6 +840,7 @@ impl App { let mut open_dir = false; let mut refresh = false; let mut create = false; + let mut add_sprites: Option<(PathBuf, String)> = None; let mut export = false; let mut new_mod = false; card(ui, |ui| { @@ -833,7 +849,14 @@ impl App { ui.horizontal_wrapped(|ui| { ui.checkbox(&mut self.gs.mods_enabled, tr("Activer les mods", "Enable mods")); ui.add_enabled_ui(self.gs.mods_enabled, |ui| { - ui.checkbox(&mut self.gs.hd_pack, tr("Décors HD", "HD backgrounds")); + ui.checkbox(&mut self.gs.hd_pack, tr("Pack HD", "HD pack")); + }); + }); + ui.horizontal_wrapped(|ui| { + ui.add_space(24.0); + ui.add_enabled_ui(self.gs.mods_enabled && self.gs.hd_pack, |ui| { + ui.checkbox(&mut self.gs.hd_decors, tr("Décors", "Backgrounds")); + ui.checkbox(&mut self.gs.hd_sprites, tr("Personnages et objets", "Characters and objects")); }); }); if self.gs.filter == 3 && self.gs.hd_pack { @@ -856,6 +879,29 @@ impl App { if m.hd_images > 0 { ui.label(RichText::new(format!("HD · {} {}", m.hd_images, tr("décors", "backgrounds"))).color(ACCENT).small()); } + if m.hd_sprites > 0 { + ui.label(RichText::new(format!("{} {}", m.hd_sprites, tr("sprites", "sprites"))).color(ACCENT).small()); + } + // pack de décors sans sprites (ou incomplet) : les créer avec le même modèle + if let (Some(model), true, true) = (&m.model, m.hd_images > 0 && !m.hd_sprites_complete, self.upscayl.is_some()) { + let label = match (m.hd_sprites, en) { + (0, false) => "+ sprites HD", + (0, true) => "+ HD sprites", + (_, false) => "Compléter les sprites HD", + (_, true) => "Complete the HD sprites", + }; + if ui + .add_enabled(can_create, egui::Button::new(label).small()) + .on_hover_text(if en { + format!("Creates the characters, objects and cursor in HD with the same model as the backgrounds ({model}). Takes a while.") + } else { + format!("Crée les personnages, objets et curseur en HD avec le même modèle que les décors ({model}). Prend du temps.") + }) + .clicked() + { + add_sprites = Some((m.path.clone(), model.clone())); + } + } if m.files > 0 { ui.label(RichText::new(format!("{} {}", m.files, tr("fichiers", "files"))).color(OK).small()); } @@ -888,13 +934,19 @@ impl App { ui.selectable_value(&mut self.upscayl_model, m.clone(), m); } }); - if ui.add_enabled(can_create, egui::Button::new(tr("Créer le pack", "Create pack"))).clicked() { + ui.checkbox(&mut self.pack_decors, tr("Décors", "Backgrounds")); + ui.checkbox(&mut self.pack_sprites, tr("Personnages et objets", "Characters and objects")); + let some = self.pack_decors || self.pack_sprites; + if ui.add_enabled(can_create && some, egui::Button::new(tr("Créer le pack", "Create pack"))).clicked() { create = true; } }); ui.label(RichText::new(format!( "{} mods\\{}", - tr("122 décors agrandis ×4, quelques secondes à quelques minutes. Dossier :", "122 backgrounds upscaled ×4, seconds to minutes. Folder:"), + tr( + "Tout le pack avec le même modèle. Décors : 122 images, quelques minutes ; personnages et objets : plusieurs milliers d'images, nettement plus long. Dossier :", + "The whole pack with one model. Backgrounds: 122 images, a few minutes; characters and objects: thousands of images, much longer. Folder:" + ), mods::pack_id(&self.upscayl_model) )).weak().small()); } else { @@ -949,7 +1001,7 @@ impl App { } }); if running { - ui.label(RichText::new(tr("En jeu : « Décors HD » se change aussi avec F12.", "In game: toggle « HD backgrounds » with F12.")).weak()); + ui.label(RichText::new(tr("En jeu : le pack HD se règle aussi avec F12.", "In game: the HD pack can also be set with F12.")).weak()); } }); if open_dir { @@ -961,7 +1013,10 @@ impl App { self.reload_mods(); } if create { - self.create_hd_pack(); + self.create_hd_pack(None, self.upscayl_model.clone(), self.pack_decors, self.pack_sprites); + } + if let Some((path, model)) = add_sprites { + self.create_hd_pack(Some(path), model, false, true); } if export { self.export_originals(); diff --git a/launcher/src/mods.rs b/launcher/src/mods.rs index bae372d..34f7aa8 100644 --- a/launcher/src/mods.rs +++ b/launcher/src/mods.rs @@ -1,7 +1,7 @@ //! Mods et pack HD, côté launcher : voir docs/MODS.md. //! - un mod = un sous-dossier de mods/ (ignoré s'il commence par « _ » ou « . ») ; //! - mod.ini [mod] name / author / description, lu seulement par le launcher ; -//! - hd/*.png : décors HD ; files/** : fichiers remplacés. +//! - hd/*.png : décors HD ; hd/SHEETS/*.png, hd/SPRITES/*.png : sprites HD ; files/** : fichiers remplacés. //! Les mods s'appliquent dans l'ordre alphabétique : pour un même fichier, le dernier l'emporte. use std::path::{Path, PathBuf}; @@ -13,6 +13,12 @@ pub struct Mod { pub author: String, pub description: String, pub hd_images: usize, + /// planches et fichiers SPR en HD (hd/SHEETS, hd/SPRITES) + pub hd_sprites: usize, + /// tous les fichiers SPR du jeu ont leur planche HD (au moins une page par fichier) + pub hd_sprites_complete: bool, + /// modèle Upscayl du pack (mod.ini model=, sinon déduit du nom hd_upscayl[_modèle]) + pub model: Option, pub files: usize, } @@ -46,8 +52,8 @@ fn count_png(d: &Path) -> usize { .unwrap_or(0) } -fn read_ini(path: &Path) -> (String, String, String) { - let (mut name, mut author, mut desc) = (String::new(), String::new(), String::new()); +fn read_ini(path: &Path) -> (String, String, String, String) { + let (mut name, mut author, mut desc, mut model) = (String::new(), String::new(), String::new(), String::new()); if let Ok(text) = std::fs::read_to_string(path) { let mut in_mod = false; for line in text.lines() { @@ -64,12 +70,21 @@ fn read_ini(path: &Path) -> (String, String, String) { "name" => name = v.trim().to_string(), "author" => author = v.trim().to_string(), "description" => desc = v.trim().to_string(), + "model" => model = v.trim().to_string(), _ => {} } } } } - (name, author, desc) + (name, author, desc, model) +} + +/// modèle d'un pack créé par le launcher, d'après son nom de dossier +fn model_from_id(id: &str) -> Option { + if id == "hd_upscayl" { + return Some(DEFAULT_MODEL.into()); + } + id.strip_prefix("hd_upscayl_").filter(|m| !m.is_empty()).map(str::to_string) } pub fn list(mods_dir: &Path) -> Vec { @@ -83,12 +98,16 @@ pub fn list(mods_dir: &Path) -> Vec { return None; } let path = e.path(); - let (name, author, description) = read_ini(&path.join("mod.ini")); + let (name, author, description, model) = read_ini(&path.join("mod.ini")); Some(Mod { name: if name.is_empty() { id.clone() } else { name }, author, description, hd_images: count_png(&path.join("hd")), + hd_sprites: count_png(&path.join("hd").join("SHEETS")) + count_png(&path.join("hd").join("SPRITES")), + hd_sprites_complete: count_png(&path.join("hd").join("SHEETS")) > 0 + && count_png(&path.join("hd").join("SPRITES")) >= SPR_FILES, + model: if model.is_empty() { model_from_id(&id) } else { Some(model) }, files: count_files(&path.join("files")), id, path, @@ -186,6 +205,9 @@ pub fn upscayl_models(bin: &Path) -> Vec { pub const DEFAULT_MODEL: &str = "digital-art-4x"; +/// nombre de fichiers SPRITES\*.SPR du jeu (version française) +pub const SPR_FILES: usize = 654; + /// dossier des décors d'origine exportés en PNG : commence par « _ », donc ignoré par le jeu pub const EXPORT_DIR: &str = "_decors_originaux"; @@ -256,8 +278,8 @@ pub fn write_mod_ini(mod_dir: &Path, model: &str) { let _ = std::fs::write( p, format!( - "[mod]\nname=Décors HD (Upscayl, {model})\nauthor=créé par le launcher\n\ - description=Décors du jeu agrandis ×4 avec Upscayl (Real-ESRGAN, modèle {model})\n" + "[mod]\nname=Pack HD (Upscayl, {model})\nauthor=créé par le launcher\nmodel={model}\n\ + description=Images du jeu agrandies ×4 avec Upscayl (Real-ESRGAN, modèle {model})\n" ), ); } diff --git a/launcher/src/settings.rs b/launcher/src/settings.rs index f7bf923..3a13c93 100644 --- a/launcher/src/settings.rs +++ b/launcher/src/settings.rs @@ -14,7 +14,10 @@ pub struct GameSettings { pub filter: usize, pub aspect_43: bool, pub vsync: bool, + /// interrupteur général du pack HD ; hd_decors / hd_sprites en coupent une partie pub hd_pack: bool, + pub hd_decors: bool, + pub hd_sprites: bool, pub vol: [u32; 4], pub mods_enabled: bool, /// dossier des mods ; vide = détection automatique par le jeu @@ -33,6 +36,8 @@ impl Default for GameSettings { aspect_43: true, vsync: false, hd_pack: true, + hd_decors: true, + hd_sprites: true, vol: [100; 4], mods_enabled: true, mods_dir: String::new(), @@ -98,6 +103,8 @@ impl GameSettings { ("display", "aspect_43") => s.aspect_43 = parse_bool(v).unwrap_or(s.aspect_43), ("display", "vsync") => s.vsync = parse_bool(v).unwrap_or(s.vsync), ("display", "hd_pack") => s.hd_pack = parse_bool(v).unwrap_or(s.hd_pack), + ("display", "hd_decors") => s.hd_decors = parse_bool(v).unwrap_or(s.hd_decors), + ("display", "hd_sprites") => s.hd_sprites = parse_bool(v).unwrap_or(s.hd_sprites), ("mods", "enabled") => s.mods_enabled = parse_bool(v).unwrap_or(s.mods_enabled), ("mods", "dir") => s.mods_dir = v.to_string(), ("mods", "disabled") => { @@ -123,6 +130,8 @@ impl GameSettings { ("display", "aspect_43", b(self.aspect_43)), ("display", "vsync", b(self.vsync)), ("display", "hd_pack", b(self.hd_pack)), + ("display", "hd_decors", b(self.hd_decors)), + ("display", "hd_sprites", b(self.hd_sprites)), ]; for (i, k) in VOLUMES.iter().enumerate() { e.push(("audio", k, self.vol[i].to_string()));