Browse Source

font updates, dialogue stuff

pixelbath 1 month ago
parent
commit
5ef8782397
2 changed files with 77 additions and 28 deletions
  1. BIN
      rpg/rpg.aseprite
  2. 77 28
      rpg/rpg.lua

BIN
rpg/rpg.aseprite


+ 77 - 28
rpg/rpg.lua

@@ -21,10 +21,12 @@ function read_p_opt()
 
 end
 
+local talked_b = false
+
 local dlg = {
     ["intro_01"] = {
         { "SMITH", "You're being summoned to the Royal Court." },
-        { "SMITH", "The guards are waiting for you out back. I can finish up here." },
+        { "SMITH", "The guards are waiting for you out back. I can finish up here.", function() talked_b = true end },
     },
     ["intro_blacksmith"] = {{ "SMITH", "Go on, now." }},
     ["intro_02"] = {
@@ -39,12 +41,24 @@ local dlg = {
     -- ],
     
 }
+local dlg_key = "intro_01"
 local dlg_idx = 1
 
 function display_dialog(key_name)
+    -- return dlg[key_name][dlg_idx][1]
     return dlg[key_name][dlg_idx][1] .. ": " .. dlg[key_name][dlg_idx][2]
 end
 
+function callback_dialog(key_name)
+    local cb_func = dlg[key_name][dlg_idx][3]
+    if cb_func then
+        cb_func()
+    else
+        dlg_idx = dlg_idx + 1
+    end
+
+end
+
 function set1bpp()
  poke4(2 * 0x3ffc, 8) -- 0b1000
 end
@@ -72,14 +86,35 @@ function draw_dialog_box(chr_idx)
 	spr(395,x+w-8,y)
 	spr(425,x,y+h-8)
 	spr(427,x+w-8,y+h-8)
+
+    -- portrait
+    spr(396, 36, 48, 0, 1, 0, 0, 4, 4)
+    spr(452, 36, 48, 14, 1, 0, 0, 4, 4)
+end
+
+-- PMEM slots 0-255
+-- 0:
+-- 1:
+-- 2:
+function save_game(slot_id)
+
 end
 
-function draw_dialog_text(lines)
+function load_game(slot_id)
+
+end
+
+function draw_dialog_text(lines, shadow)
+    local shd = shadow or 1
     local offset = 0
     for i=1,#lines do
+        if shd then
+            wrt(lines[i], 41, 87+(offset*10), 0)
+        end
         wrt(lines[i], 40, 86+(offset*10), 15)
         offset = offset + 1
     end
+
 end
 
 -- basically print() but for font() setup at 1bpp
@@ -93,13 +128,13 @@ end
 
 testlines = {
     "BLACKSMITH",
-    "What the actual &#@! is ",
-    "going on here?! You think you",
-    "can just write lines as long"
+    "What the actual &#@! is going",
+    "on here?! You think you can",
+    "just write lines as long as"
 }
 
 function TIC()
-    cls(0)
+    cls(3)
 
     -- wrt(" !\"#$%&'()*+,-./0123456789:;<=>?", 10, 10, 8)
     -- wrt("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", 10, 20, 9)
@@ -107,7 +142,21 @@ function TIC()
     -- wrt("We will learn to make this look less childish over time.", 10, 40, 15)
 
     draw_dialog_box()
-    draw_dialog_text(testlines)
+
+    if talked_b then
+        dlg_key = "intro_blacksmith"
+        dlg_idx = 1
+        talked_b = false
+    end
+
+    cur_dialog = display_dialog(dlg_key)
+    -- TODO: a counter/flag to indicate when text is ready
+
+    if btnp(5) then
+        callback_dialog(dlg_key)
+    end
+    wrt(cur_dialog, 10, 20, 9)
+    -- draw_dialog_text(testlines)
 
     -- read_p_opt()
 end
@@ -210,8 +259,8 @@ end
 -- 029:707077777000a777a700aaa0a0b0aaaaa0b0aa0a0000000007a7a7a707a7a7a7
 -- 030:700aa0bba0aaa0bba0a00b00a00bbb0aa0bbbbb000000070a7a7a70aa7a7a70a
 -- 031:bbbbbbbb00000bbbaaaaa00b0a0a0a0baaaaa0bb0700000ba0a7a70ba0a7a70b
--- 032:000000020081c6420081c6e70081844200800042000000e70080004200000040
--- 033:01008100870042c0414241c08301808005804600c342a200010021000000c200
+-- 032:008100010081c6410081c6e300818441008000e3000000410080004000000000
+-- 033:0100c000870021c04142a0c0830146800580a200c34221000100c20000000000
 -- 034:0180000080014580800101808001c7e380010180800145808001000001800000
 -- 035:00000000000000020000000200c3000100000001810081808100818001000000
 -- 036:6777666666463366643666367333316666666336666663667663166767366776
@@ -226,10 +275,10 @@ end
 -- 045:44999bbbffffa9bbf00ff4bbf0f0f4bbf0f0f4bbf0f0f4bbfffff4bb44444bbb
 -- 046:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbababbbbb377bbbbba37bbbbb733bbbb73b3
 -- 047:bba7bbbbba73bbbba73bbbbb73bbbbbb3bbbbbbbbbbbbbbbabbbbbbb7bbbbbbb
--- 048:000000008181818142414242420102022180818121804021c0e1e1c000000000
--- 049:00000000428383834140400221c1c101c002220180212180e1c0c08000000000
--- 050:000000008381000042428181c122818122c3000021018181c0e0818100000001
--- 051:000000000300c08181c38142c000030281c381810300c0000000008000000000
+-- 048:00000000c0c0c0c021a0212161800180a180800121804021c0e1e1c000000000
+-- 049:0000000021e1c0c121202001e1e0e080010121800121218001c0c08000000000
+-- 050:00000000c0c0000021218181c021818121c1000021018181c0c0818100000001
+-- 051:000000810300c04281c38102c000030181c381800300c0000000008000000000
 -- 052:6767666637667366146666136466676666336666676646644666633646667666
 -- 053:6663336666366377376666446667336663764466466666766666673336677114
 -- 054:0900000009999999044444440444444404444444044444000444400040000000
@@ -240,21 +289,21 @@ end
 -- 059:300555bb3355bbbb11bbbbbb91bbbbbb90bbbbbb40bbbbbb00bbbbbbbbbbbbbb
 -- 060:bbbbbbb1bbbbbbb3bbbbbbb4bbbbbbb4bbbbbbb4bbbbbb44bbbbb111bbbb5555
 -- 061:3bbbbbbb9bbbbbbb9bbbbbbb9bbbbbbb9bbbbbbb49bbbbbb449bbbbb55bbbbbb
--- 064:0083e181814242424242424043e3e1202322222020222222c122e1c100100000
--- 065:c181c381424040424240404022e0e0202220202722202022e1c120c100000000
--- 066:428307424201024242010241e18001e0218001212180212121c1e02100000000
--- 067:4044448140c64442404544426022a2222022a22221222322e12223c100000200
--- 080:c381e3814242424242424240e122e18120a221022023222220c122c100000000
--- 081:87444444414444440144444480224222802242a28022416380c1802200000000
--- 082:4444c3c1424402404142014080818020418040204180222022c1e1e000000000
--- 083:000780004004410040042200800200008002000001020000018300e300000000
--- 096:00006000e0814000c102c18103c24240002322200022222200c5e1c100000000
--- 097:0400060004000100858101834242c34422a1804422208087c1c1800400000083
--- 098:4000004040010041c1000241420100e0220102a0228002212180422100018100
--- 099:40000000400000004061a18120a262422022224220222242c022228100000100
--- 112:000000000000000000004307818380808242400142424002c18340c140020000
--- 113:0100000001000000c34242228042422280424222844282a20383016100000000
--- 114:0000000100000080820000808244c34001840180820380808202c30100c10000
+-- 064:c081e0c02142212121422120a1c3e020a142212020422121c142e0c000000000
+-- 065:e0e0e0c0212020212120202021e0e020212020a121202021e0e020c000000000
+-- 066:21c1832121800121218001a0e1800160218001a02180212121c1c02100000000
+-- 067:202222c02063622120a262212022a2212022a22120222321e12223c000000000
+-- 080:e0c0e0812121214221212140e021e0812021210220a1214220c1218100000000
+-- 081:e3214222802142228021422280214222802142a28021416380c0802200000000
+-- 082:2222c3e022220220414101208080012041808020228040202280c3e000000000
+-- 083:008380004002410040022200800200008002000001020000018300e300000000
+-- 096:00004000e0004000c1c1c1c103214220002142200021422000c3c1c100000000
+-- 097:020003000200800083c180034222c38442e180844220800783c3800400000083
+-- 098:4000002040010421c10000a042010460420104a0420104214201842100000300
+-- 099:2000000020000000206143c120a2c4222022442220224422c02244c100000000
+-- 112:0000000000000000c18343834242c0404242408142424002c18340c140020000
+-- 113:8000000080000000c14242228042422280424222804282a20383016100000000
+-- 114:00000001000000804284c3804284024081840180420780804204c30100830000
 -- 115:01800000010100000101c4000102230001010000010100000180000000000000
 -- 137:010111111e1eeeee01e555551e5522221e5222221e5222221e5222221e522222
 -- 138:11111111eeeeeeee555555552222222222222222222222222222222222222222