Skip to content

Commit

Permalink
Say replay, not restart
Browse files Browse the repository at this point in the history
  • Loading branch information
nomeata committed Dec 18, 2020
1 parent 18c5fc7 commit 7c27283
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Audio filenames can now be quoted, to support filenames with characters
outside the range `a-zA-Z0-9_`. Audio files can also be given including
their extension.
* Support for the `stop` and `restart` codes (generated by default)
* Support for the `stop` and `replay` codes (generated by default)
* The `set-language` command truncates long language names (like `ITALIAN`)
automatically.
* The output of `tttool export` has the YAML fields in a more sensible order
Expand Down
2 changes: 1 addition & 1 deletion GME-Format.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Example from Puzzle Ponyhof:
0x00F05E60: 00 00 00 00 00 00 00 00 01 00 66 18
pp pp pp pp pp pp pp pp ff ff gg gg

a: OID for the Restart symbol
a: OID for the Replay symbol
b: OID for the Stop symbol
c: unknown, seems to be the OID for Skip symbol (needs to be confirmed)
d: unknown
Expand Down
2 changes: 1 addition & 1 deletion book/erste-schritte.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Nun brauchst du noch den zugehörigen Ausdruck mit den Punktmustern. Auch hier m
erstellt dir das ``tttool`` die Datei ``tic-tac-tiptoi.pdf``, die alle
Punktmuster für dein Werk in einer nüchternen, aber praktischen Tabelle
enthält. Du siehst dort neben dem Feld für ``feldOL`` auch eines mit der Beschriftung ``START``, dem Anschaltzeichen für dein Produkt, sowie ``RESTART`` und ``STOP``, die man erstmal ignorieren darf.
enthält. Du siehst dort neben dem Feld für ``feldOL`` auch eines mit der Beschriftung ``START``, dem Anschaltzeichen für dein Produkt, sowie ``REPLAY`` und ``STOP``, die man erstmal ignorieren darf.

Wenn du diese Datei nun ausdruckst, mit dem Stift auf das Anschaltzeichen gehst, und danach auf das andere Feld, solltest du eine Roboterstimme hören, die „Du hast oben links hingetippt.“ sagt.

Expand Down
4 changes: 2 additions & 2 deletions book/tttool-referenz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Aber oft willst du einfach alle Codes eines GME-Projektes erzeugen. Dazu kannst

$ tttool oid-codes example.yaml
Writing oid-42-START.png.. (Code 42, raw code 272)
Writing oid-42-RESTART.png.. (Code 13445, raw code 9250)
Writing oid-42-REPLAY.png.. (Code 13445, raw code 9250)
Writing oid-42-STOP.png.. (Code 13446, raw code 9251)
Writing oid-42-8065.png.. (Code 8065, raw code 3700)
Writing oid-42-8066.png.. (Code 8066, raw code 3701)
Expand All @@ -94,7 +94,7 @@ Die erste Zahl im Dateinamen ist die Produkt-ID des Projekts, was dir helfen sol

$ tttool oid-codes example2.yaml
Writing oid-42-START.png.. (Code 42, raw code 272)
Writing oid-42-RESTART.png.. (Code 13445, raw code 9250)
Writing oid-42-REPLAY.png.. (Code 13445, raw code 9250)
Writing oid-42-STOP.png.. (Code 13446, raw code 9251)
Writing oid-42-conditional.png.. (Code 13447, raw code 9252)
Writing oid-42-hello.png.. (Code 13448, raw code 9253)
Expand Down
6 changes: 3 additions & 3 deletions book/yaml-referenz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ eigentliche YAML-Datei zu übernehmen.
die beiden Varianten nicht mischen.


``restart``
``replay``
^^^^^^^^^^^

Format:
Expand All @@ -272,13 +272,13 @@ Format:
Beispiel:
.. code:: yaml
restart: 12159
replay: 12159
Zweck:
Beim Tippen auf diesen Code wird das zuletzt ausgegebene Audio nochmal ausgegeben.


Auch wenn man diesen dies nicht explizit in der .yaml-Datei notiert, weist das ``tttool`` einen solchen Code zu, und erzeugt ein ``RESTART``-Muster aus.
Auch wenn man diesen dies nicht explizit in der .yaml-Datei notiert, weist das ``tttool`` einen solchen Code zu, und erzeugt ein ``REPLAY``-Muster aus.

``stop``
^^^^^^^^^^^
Expand Down
4 changes: 2 additions & 2 deletions src/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ codesOfFile inf = do
writeTipToiCodeYaml inf tty codeMap totalMap
return $ (ttProductId tt,
[ ("START", fromIntegral (ttProductId tt)) ] ++
[ ("RESTART", fromIntegral id) | Just id <- pure $ ttcRestart totalMap ] ++
[ ("STOP", fromIntegral id) | Just id <- pure $ ttcStop totalMap ] ++
[ ("REPLAY", fromIntegral id) | Just id <- pure $ ttcReplay totalMap ] ++
[ ("STOP", fromIntegral id) | Just id <- pure $ ttcStop totalMap ] ++
sort (M.toList (ttcScriptCodes totalMap))
)
where
Expand Down
4 changes: 2 additions & 2 deletions src/GMEWriter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ putAudioTable x as = mapFstMapSnd
putSpecialSymbols :: Maybe (Word16, Word16) -> SPut
putSpecialSymbols Nothing =
replicateM_ 20 $ putWord16 0
putSpecialSymbols (Just (restart, stop)) = do
putWord16 restart
putSpecialSymbols (Just (replay, stop)) = do
putWord16 replay
putWord16 stop
replicateM_ 20 $ putWord16 0

Expand Down
20 changes: 10 additions & 10 deletions src/TipToiYaml.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ data TipToiYAML = TipToiYAML
, ttySpeak :: Maybe (OptArray SpeakSpec)
, ttyLanguage :: Maybe Language
, ttyGames :: Maybe [GameYaml]
, ttyRestart :: Maybe Word16
, ttyReplay :: Maybe Word16
, ttyStop :: Maybe Word16
}
deriving Generic

data TipToiCodesYAML = TipToiCodesYAML
{ ttcScriptCodes :: CodeMap
, ttcRestart :: Maybe Word16
, ttcReplay :: Maybe Word16
, ttcStop :: Maybe Word16
}
deriving (Eq, Generic)
Expand Down Expand Up @@ -314,7 +314,7 @@ tt2ttYaml path TipToiFile{..} = TipToiYAML
, ttySpeak = Nothing
, ttyLanguage = Nothing
, ttyGames = list2Maybe $ map game2gameYaml ttGames
, ttyRestart = fmap fst ttSpecialOIDs
, ttyReplay = fmap fst ttSpecialOIDs
, ttyStop = fmap snd ttSpecialOIDs
}

Expand Down Expand Up @@ -695,15 +695,15 @@ scriptCodes codes givenCodes productId
(strs, nums) = partitionEithers $ map f codes
newStrs = filter (`M.notMember` ttcScriptCodes givenCodes) strs
usedCodes = S.fromList $
maybeToList (ttcRestart givenCodes) ++
maybeToList (ttcReplay givenCodes) ++
maybeToList (ttcStop givenCodes) ++
M.elems (ttcScriptCodes givenCodes)

f s = case readMaybe s of
Nothing -> Left s
Just n -> Right (n::Word16)

restartCode : stopCode : availableCodes =
replayCode : stopCode : availableCodes =
filter (`S.notMember` usedCodes) $
codesFor productId

Expand All @@ -719,7 +719,7 @@ scriptCodes codes givenCodes productId

allCodes = TipToiCodesYAML
{ ttcScriptCodes = totalMap
, ttcRestart = ttcRestart givenCodes `mplus` Just restartCode
, ttcReplay = ttcReplay givenCodes `mplus` Just replayCode
, ttcStop = ttcStop givenCodes `mplus` Just stopCode
}

Expand Down Expand Up @@ -785,7 +785,7 @@ ttYaml2tt no_date dir (TipToiYAML {..}) extCodes = do
let givenCodes = TipToiCodesYAML
{ ttcScriptCodes =
M.unionWithKey mergeOnlyEqual (ttcScriptCodes extCodes) (fromMaybe M.empty ttyScriptCodes)
, ttcRestart = mergeEqualMaybe "restart" (ttcRestart extCodes) ttyRestart
, ttcReplay = mergeEqualMaybe "replay" (ttcReplay extCodes) ttyReplay
, ttcStop = mergeEqualMaybe "stop" (ttcStop extCodes) ttyStop
}

Expand Down Expand Up @@ -893,7 +893,7 @@ ttYaml2tt no_date dir (TipToiYAML {..}) extCodes = do
, ttBinaries5 = []
, ttBinaries6 = []
, ttSpecialOIDs = Just
( fromMaybe 0 (ttcRestart assignedCodes)
( fromMaybe 0 (ttcReplay assignedCodes)
, fromMaybe 0 (ttcStop assignedCodes)
) -- a bit fishy, this juggling of maybes
}, assignedCodes)
Expand Down Expand Up @@ -1109,7 +1109,7 @@ writeTipToiCodeYaml inf tty oldCodeYaml allCodes = do

let newCodeYaml = TipToiCodesYAML
{ ttcScriptCodes = newCodeMap
, ttcRestart = if isJust (ttcRestart allCodes) && ttcRestart allCodes /= ttyRestart tty then ttcRestart allCodes else Nothing
, ttcReplay = if isJust (ttcReplay allCodes) && ttcReplay allCodes /= ttyReplay tty then ttcReplay allCodes else Nothing
, ttcStop = if isJust (ttcStop allCodes) && ttcStop allCodes /= ttyStop tty then ttcStop allCodes else Nothing
}

Expand Down Expand Up @@ -1162,7 +1162,7 @@ debugGame productID = do
]
, ttyLanguage = Nothing
, ttyGames = Nothing
, ttyRestart = Nothing
, ttyReplay = Nothing
, ttyStop = Nothing
}
where
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0fd54c3bbb1a88b494972a2547b08f9f output/downloaded/Alle meine Tiere.gme.yaml
b8d364d85b18b7af68537782f90b5dad output/downloaded/Alle meine Tiere.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e2f933effc132ed235888e4f0bf22e8f output/downloaded/Dein Koerper und Du.gme.yaml
6145ef87ab3ed2c21bfdb7acff9d6554 output/downloaded/Dein Koerper und Du.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
61a09460d93d53c8c5383248973bf1a7 output/downloaded/Duell-der-Superquizzer.gme.yaml
35cc30d987a9794f9f6d6af839caf457 output/downloaded/Duell-der-Superquizzer.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0a99dc6315e77ff0efb0c91928480327 output/downloaded/Expedition Wissen - Aegypten.gme.yaml
3f5955cbcf2a9ab1cd08b775fc3b4698 output/downloaded/Expedition Wissen - Aegypten.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dafec43004052b310638581994076b1a output/downloaded/Leserabe Drache.gme.yaml
1ecc247aa79e0f300ca3b482ef7b8a89 output/downloaded/Leserabe Drache.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d07aa7d8a23e0c44434ef65480a2cdc2 output/downloaded/Pocket Wissen - Baustellenfahrzeuge.gme.yaml
15b6e65429c2880108cd12642b3a418d output/downloaded/Pocket Wissen - Baustellenfahrzeuge.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f5e67b74de9ab84284e8774c18f8676b output/downloaded/Sprichst_Du_Englisch.gme.yaml
f3b669b4c86292c5d312888ada77c034 output/downloaded/Sprichst_Du_Englisch.gme.yaml
2 changes: 1 addition & 1 deletion testsuite/expected/downloaded/WWW Ritter.gme.yaml.md5sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6f5bf51d420207eab67410815c9e0040 output/downloaded/WWW Ritter.gme.yaml
4f6157b8fd374361e54ff617868db893 output/downloaded/WWW Ritter.gme.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b249ea76eb99cb6871e94c560b029e54 output/downloaded/WWW Weltatlas.gme.yaml
a76a350d385c46f1e835b3ba0fdd546a output/downloaded/WWW Weltatlas.gme.yaml
2 changes: 1 addition & 1 deletion testsuite/expected/example.rexport.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ scripts:
- $1==2? P(5)
- $1==3? P(4)
- $1!=1? $1!=2? $1!=3? $1:=0 P(0)
restart: 13445
replay: 13445
stop: 13446

0 comments on commit 7c27283

Please sign in to comment.