Author Topic: [solved] "D" file format expansion: EE Transition table Flags support  (Read 1666 times)

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
Currently weidu D format only supports bti0-bit8 transition table flags. Patch 2.x for EE games added 2 new flags:
- bit9: Execute immediate - executes actions without delay instead of being added through the dialogue owner's action queue. I think it's mostly usefull as an alternative for ToBEx DialogueSetGlobal, DialogueIncrementGlobal, DialogueSG actions that allows variables to be set instantaneously and checked immediately afterwards in the same dialogue.
- bit10: Clear Actions - not sure what problems this bit is meant to solve - any ideas?

Other bits syntax in D format is "EXIT", "UNSOLVED_JOURNAL" etc. so I think both new bits should be supported the same way, so for example as "INSTANT_ACTIONS", "CLEAR_ACTIONS". Weidu should either ignore them on non-EE games or print some warning when present.
« Last Edit: August 14, 2017, 12:10:12 PM by K4thos »

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
According to the WeiDU docs there is already a FLAGS option that can be used to set arbitrary transition flags directly.

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
neat, but shouldn't weidu decomile FLAGS into D format in such case (DECOMPILE_DLG_TO_D and command line decompile feature) so they are not missing after compiliation? I don't think it's the case although I will check it out.

edit: quote from documentation:
Quote
FLAGS: Used to set transition flags manually, though I can’t imagine why one would do this.
well, now there is a real purpose. I think naming them properly rather than using integer is the way to go. btw. what integer should be used for bit9 - 9 or 512?
« Last Edit: August 13, 2017, 09:05:27 AM by K4thos »

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Looks like FLAGS is implemented in a very rudimentary way. It accepts only straight numeric values (i.e. no expressions), variable evaluation seems to work though. Defining multiple FLAGS instances don't make sense. Only the latest instance is used.

Examples: "FLAGS 512" sets bit 9, "FLAGS 1536" sets bits 9 and 10 (512 + 1024). You can also use BITx constants when you add EVAL to the COMPILE action, e.g. FLAGS ~%BIT9%~ is evaluated to FLAGS 512.

WeiDU decompiles DLG with FLAGS correctly when used at command line. DECOMPILE_DLG_TO_D and DECOMPILE_AND_PATCH appear to work as well.
« Last Edit: August 13, 2017, 09:32:50 AM by Argent77 »

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
thanks, looks like the current implementation does the job already. I can cofirm that flags are correctly decompiled (SoD BDMURS.DLG).

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 66
ToBEx adds DialogueSetGlobal and DialogueIncrementGlobal to be used in d files which have the same meaning as BIT9.

To provide compatibility with BG2 and BG2:EE, I used until now this kind of coding:

Code: [Select]
IF ~~ DO ~%GWDialogue%SetGlobal("GW#GwendyNO","GLOBAL",0) %GWDialogue%SetGlobal("GW#GwendyOK","GLOBAL",1) EraseJournalEntry(@3590012) AddJournalEntry(@3590014,INFO)~ EXTERN GWGWENDY Gwendolynette.Bag

with
Code: [Select]
BG2 : OUTER_SPRINT GWDialogue "Dialogue"
BG2:EE : OUTER_SPRINT GWDialogue ""

How to use the FLAGS BIT9 in this case? I mean something like FLAGS BIT9 for BG2:EE compilation and nothing for BG2, in the same d file?

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
I don't think BIT9 has any effect in the classic games, so the following line should safely work for all games:
Code: [Select]
IF ~~ DO ~%GWDialogue%SetGlobal("GW#GwendyNO","GLOBAL",0) %GWDialogue%SetGlobal("GW#GwendyOK","GLOBAL",1) EraseJournalEntry(@3590012) AddJournalEntry(@3590014,INFO)~ FLAGS ~%BIT9%~ EXTERN GWGWENDY Gwendolynette.Bag

Or for more clarity you could set a more descriptive variable that is used in place of BIT9, e.g.  set
Code: [Select]
OUTER_SET INSTANT_ACTIONS = BIT9in the .tp2 file and use
Code: [Select]
FLAGS ~%INSTANT_ACTIONS%~in the .d file.

Edit: Or define
Code: [Select]
OUTER_SET INSTANT_ACTIONS = 0for classic BG2. In this case no flags should be set.
« Last Edit: August 13, 2017, 11:43:51 AM by Argent77 »

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 66
Does it mean that FLAGS 0 does not break anything? I mean if I add SOLVED_JOURNAL (for example) in the same line.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
It appear so (at least it did in my tests). JOURNAL options seem to be added after FLAGS is applied.

Offline Gwendolyne_FP

  • Planewalker
  • *****
  • Posts: 66
Thanks a lot!

This tip will help me to resolve my last compatibility problem with compiling dialogs. ;)

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
So, everything good or do you want me to do something?

Offline K4thos

  • Planewalker
  • *****
  • Posts: 110
all good, I will mark the topic as solved. Thanks guys for help.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: