diff --git a/games/rpg/CMakeLists.txt b/games/rpg/CMakeLists.txt index 9eb65a7..a3f56e8 100644 --- a/games/rpg/CMakeLists.txt +++ b/games/rpg/CMakeLists.txt @@ -5,7 +5,14 @@ add_executable(rpg src/tile_renderer.cc src/character.cc src/map_scene.cc - src/world.cc) + src/world.cc + src/text.cc + src/dialogue.cc + src/items.cc + src/npc.cc + src/dialogue_scene.cc + src/inventory_scene.cc + src/title_scene.cc) target_include_directories(rpg PRIVATE src) target_link_libraries(rpg PRIVATE engine) enable_warnings(rpg) diff --git a/games/rpg/README.md b/games/rpg/README.md index 4af0743..116ca9f 100644 --- a/games/rpg/README.md +++ b/games/rpg/README.md @@ -10,7 +10,10 @@ |---|---| | 矢印 / WASD | 移動 / move | | Shift | 走る / run | -| Space / Enter | 調べる(宝箱) / check (chests) | +| Space / Enter | 話す・調べる(人・宝箱・看板・門)、会話を進める / talk, check (people, chests, signs, the gate), advance dialogue | +| ↑ ↓ | 会話の選択肢 / dialogue options | +| I | 持ち物 / inventory | +| L | 日本語 ⇔ English(タイトルでは ← →) / Japanese ⇔ English (← → on the title) | | 1 2 3 | 層の表示(地面・飾り・上の層) / toggle the layers (ground, decor, overlay) | | B | 当たり判定の箱 / collision boxes | | Z | 引いて見る(行のカリングが見える) / zoom out (shows the row culling) | @@ -23,3 +26,12 @@ Maps are `assets/maps/*.map` (text). The format is described in `src/tilemap.hh`, the tile characters in `assets/tiles.tileset`. Doors are `object door map= spawn=`, exits at the edge of a map `object warp ... h=2 ...`. + +会話は `assets/dialogue.txt`(書式は `src/dialogue.hh`)、持ち物は `assets/items.txt`。フォントにない文字は `?` で +描かれる。会話に新しい漢字を使うなら、アセットのZIP(https://ass.technicalsuwako.moe/tutorial/opengl/opengl-assets.zip)の +`extras/jis-level1-fonts/games/rpg/assets/fonts/` にある pixel12(JIS第1水準の漢字をすべて含む、寸法は同じ)で +`assets/fonts/pixel12.png` と `.fnt` を置き換える。 +Dialogue is in `assets/dialogue.txt` (format in `src/dialogue.hh`), items in `assets/items.txt`. A character missing +from the font is drawn as `?`. To use new kanji in the dialogue, replace `assets/fonts/pixel12.png` and `.fnt` with +the pixel12 in `extras/jis-level1-fonts/games/rpg/assets/fonts/` of the assets ZIP +(https://ass.technicalsuwako.moe/tutorial/opengl/opengl-assets.zip): every JIS level-1 kanji, the same metrics. diff --git a/games/rpg/assets/LICENSE.txt b/games/rpg/assets/LICENSE.txt index 186a128..4de0bba 100644 --- a/games/rpg/assets/LICENSE.txt +++ b/games/rpg/assets/LICENSE.txt @@ -6,6 +6,21 @@ tiles.png/.atlas 16×16のタイル(草・道・水・木・家・家具 characters.png 人物5人 × 4方向の歩き(16×16、9コマずつ) / five characters × 4-direction walk (16×16, 9 frames each) (chapter 33) tiles.tileset タイルの文字・固さ・動き(手書き) / tile characters, solidity, animation (hand-written, chapter 33) -maps/village.map 村のマップ / the village map (chapters 33-34; edit by hand freely) -maps/home.map 家の中 / the house interior (chapter 34) -maps/field.map 野原 / the field (chapter 34) +maps/village.map 村のマップ / the village map (chapters 33-35; edit by hand freely) +maps/home.map 家の中 / the house interior (chapters 34-35) +maps/field.map 野原 / the field (chapters 34-35) +items.png/.atlas 持ち物のアイコン(16×16)ときらめき / item icons (16×16) and a sparkle (chapter 35) +items.txt 持ち物の名前と説明(日本語・英語、手書き) / item names and descriptions (Japanese, English; + hand-written, chapter 35) +dialogue.txt 会話の台本とクエスト(手書き) / the dialogue script and the quest (hand-written, chapter 35) +fonts/pixel12.png/.fnt + ゲームのピクセルフォント(共有のpixel12+会話の漢字47字と矢印←→) / the game's pixel font (the + shared pixel12 + 47 kanji for the dialogue and the arrows ← →) + (chapter 35) + +fonts/pixel12 の文字の画像は DejaVu Sans Mono(Bitstream Vera License、DejaVuの変更はパブリックドメイン)と +Noto Sans CJK JP(Copyright 2014-2021 Adobe; Noto is a trademark of Google Inc.; SIL Open Font License 1.1)から +ラスタライズしたもの。フォントのファイルそのものは含まない(assets/LICENSE.txt と同じ)。 +The glyph images in fonts/pixel12 were rasterized from DejaVu Sans Mono (Bitstream Vera License, DejaVu changes in +the public domain) and Noto Sans CJK JP (Copyright 2014-2021 Adobe; Noto is a trademark of Google Inc.; SIL Open Font +License 1.1). The font files themselves are not included (as in assets/LICENSE.txt). diff --git a/games/rpg/assets/dialogue.txt b/games/rpg/assets/dialogue.txt new file mode 100644 index 0000000..34ec330 --- /dev/null +++ b/games/rpg/assets/dialogue.txt @@ -0,0 +1,141 @@ +# 会話の台本 / the dialogue script (format: games/rpg/src/dialogue.hh) +# 人や看板は、マップの物の say=