From 6d9e7120d85f65fe650cf7c62f93f02c40973e83 Mon Sep 17 00:00:00 2001 From: Daan Vanden Bosch Date: Sun, 27 Sep 2020 16:17:13 +0200 Subject: [PATCH] Reverted change to default_ep_1.qst so it sets NPC script labels correctly again. Added a check before warning about invalid label references to see if it's a built-in function. --- assets/quests/defaults/default_ep_1.qst | Bin 3344 -> 3344 bytes .../data_formats/parsing/quest/QuestNpc.ts | 7 ++++++ .../data_formats/parsing/quest/object_code.ts | 23 +++++++++++++++++- test/src/utils.ts | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/assets/quests/defaults/default_ep_1.qst b/assets/quests/defaults/default_ep_1.qst index 16af68e954414115b1bf681804cd6404e338069d..8e30b59333ff9062a205e1fc1e9ea5dc5a351fed 100644 GIT binary patch literal 3344 zcmd6p3v5%@8OJ|Al3*MjaR8HvW(kFrZiqQkH?=DycI*HtW4vkz0YV;jAQj=!Wxz;6 zZeD0qRt43{N|7MEv@!;SzOs&n_!ZP`5~E>h<{JDW34Z(9xz{Jbkh61dAaqnn)wD?* z**@Pr-~aoa@7#Ot=Tih4_^wT-uPpoZwweXHvKl^QUkZSBdrei%HofjiM$v!4Ew9?n zW6DKO=gtzR^O`4f!2&WooD6_Dx0f@NAmpVOlmHWni4{#vCIF=pn_W|_{0J}LTmV!a z_vHf8IOs9a(~D<~4C+eJM)+b9~}269%xC zu}LN-NzW=1Q5rDh>T_bHY?^XK!q9P;g_K4*Wo{I;`A>XF101s7-=kwcv_?dKY@{J7X<=hwr;A9{ zjp21pvc-y)h$Gh{AXW=cMwU{aw7BV`p=oDA4}=hzaf7;NDEQPJl&FG|N;UyHK?LCb z3HyEPM}fU9fuvfCIs!P`h#&{V4}q@fC&khqmC%{znJfbh};|v`&_F( zwfdz3uk@@JUp*GFq)@4kmyb-I=8C-@CUn)q=#k{;p&1mG;X%xFcPu zO&F?GD$nGT?#Yn?Pj`I6X*RTzb!di^p3JFh$uz2L*OW%*6vtfGZ(km&h@LqA+3=jG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gP1(xusM3~=f?I;Y-&$GB7XY4_kyIUKnP(+g<2NqM!mo^EiU-?WS>oMpf5-+#Q9 z46XIp4x2q%>Y;Y#8C%9zbOYVKD=U|r?8$8!5Iuwc0Dqc!XaRlBMECBZcgy}+WSjlr mi@}?fAn2o^TLvw113$A}566E;@6xfv!2cx!YZiurEdK%%e4wKM diff --git a/src/core/data_formats/parsing/quest/QuestNpc.ts b/src/core/data_formats/parsing/quest/QuestNpc.ts index a3a89163..e326c667 100644 --- a/src/core/data_formats/parsing/quest/QuestNpc.ts +++ b/src/core/data_formats/parsing/quest/QuestNpc.ts @@ -145,6 +145,13 @@ export function get_npc_script_label(npc: QuestNpc): number { return Math.round(npc.view.getFloat32(60, true)); } +/** + * Only seems to be valid for non-enemies. + */ +export function set_npc_script_label(npc: QuestNpc, script_label: number): void { + npc.view.setFloat32(60, script_label, true); +} + export function get_npc_skin(npc: QuestNpc): number { return npc.view.getUint32(64, true); } diff --git a/src/core/data_formats/parsing/quest/object_code.ts b/src/core/data_formats/parsing/quest/object_code.ts index 0af2a71e..1669674a 100644 --- a/src/core/data_formats/parsing/quest/object_code.ts +++ b/src/core/data_formats/parsing/quest/object_code.ts @@ -32,6 +32,25 @@ SEGMENT_PRIORITY[SegmentType.Instructions] = 2; SEGMENT_PRIORITY[SegmentType.String] = 1; SEGMENT_PRIORITY[SegmentType.Data] = 0; +const BUILTIN_FUNCTIONS = new Set([ + 60, + 70, + 80, + 90, + 100, + 110, + 120, + 130, + 140, + 800, + 810, + 820, + 830, + 840, + 850, + 860, +]); + export function parse_object_code( object_code: ArrayBuffer, label_offsets: readonly number[], @@ -409,7 +428,9 @@ function parse_segment( const info = label_holder.get_info(label); if (info == undefined) { - logger.warn(`Label ${label} is not registered in the label table.`); + if (!BUILTIN_FUNCTIONS.has(label)) { + logger.warn(`Label ${label} is not registered in the label table.`); + } return; } diff --git a/test/src/utils.ts b/test/src/utils.ts index 1fc37058..741cc6e2 100644 --- a/test/src/utils.ts +++ b/test/src/utils.ts @@ -82,7 +82,7 @@ export function get_qst_files(dir: string): [string, string][] { // TODO: Some quests can not yet be parsed correctly. const exceptions = [ "/battle/", // Battle mode quests - "/princ/", // Goverment quests + "/princ/", // Government quests "fragmentofmemoryen.qst", "lost havoc vulcan.qst", "ep2/event/ma4-a.qst",