]> git.jsancho.org Git - lugaru.git/commitdiff
Devtools: Enhance ddialog command
authorRémi Verschelde <rverschelde@gmail.com>
Sat, 11 Feb 2017 17:04:57 +0000 (18:04 +0100)
committerRémi Verschelde <rverschelde@gmail.com>
Sat, 11 Feb 2017 17:04:57 +0000 (18:04 +0100)
It can now be used to delete a given dialog index, and not only
the last one. Also renamed "dialogue" to "dialog" as used in most
places.

Added some documentation about dialog devtools.

Docs/DEVTOOLS.txt
Source/Devtools/ConsoleCmds.cpp
Source/Devtools/ConsoleCmds.def

index 10d040c194723369c018696b0332fb683abccdc2..7312be8d63f4cf148285c71cb568886b0453d1ac 100644 (file)
@@ -219,6 +219,23 @@ dhs - deletes the last hotspot.
     the map file (make sure to change the byte before the string to the number
     of its characters).
 
     the map file (make sure to change the byte before the string to the number
     of its characters).
 
+Dialogs
+~~~~~~~
+
+dialog (int) (string) - loads the "string.txt" dialog with type "int" and enter
+    directing mode: Fly around, press numpad 1-10 to change the players' head
+    target, press 1-10 to define who is saying the current line and move on to
+    the next line. The type argument can be one of:
+        0-9 = player index, activates when "attacking" them
+        10+ = "special", activates automatically when in range; player ID is
+              the module of the type (e.g. type 18 would be special, player 8)
+        40-49 = some other thing, someone really needs to cleanup this logic :)
+fixdialog (int) (string) - replaces the dialog of given index by the one
+    described in the "string.txt" file.
+ddialog (int) - deletes given dialog (if no argument or -1, deletes the last
+    dialog). Does not work when actually playing a dialog.
+play (int) - plays given dialog.
+
 Graphics
 ~~~~~~~~
 
 Graphics
 ~~~~~~~~
 
index 10f37e81398eb6cbdf3a0a9701911d38cb04f848..3ae5e20c149856410f78cd9d6524b6ea5e9d1e1c 100644 (file)
@@ -580,7 +580,7 @@ void ch_hs(const char* args)
     strcat(Hotspot::hotspots.back().text, "\n");
 }
 
     strcat(Hotspot::hotspots.back().text, "\n");
 }
 
-void ch_dialogue(const char* args)
+void ch_dialog(const char* args)
 {
     int type;
     char buf1[32];
 {
     int type;
     char buf1[32];
@@ -595,7 +595,7 @@ void ch_dialogue(const char* args)
     Dialog::whichdialogue = Dialog::dialogs.size();
 }
 
     Dialog::whichdialogue = Dialog::dialogs.size();
 }
 
-void ch_fixdialogue(const char* args)
+void ch_fixdialog(const char* args)
 {
     char buf1[32];
     int whichdi;
 {
     char buf1[32];
     int whichdi;
@@ -619,11 +619,27 @@ void ch_fixrotation(const char*)
     Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw;
 }
 
     Dialog::currentDialog().participantyaw[playerId] = Person::players[playerId]->yaw;
 }
 
-void ch_ddialogue(const char*)
+void ch_ddialog(const char* args)
 {
 {
-    if (!Dialog::dialogs.empty()) {
+    if (Dialog::dialogs.empty() || Dialog::inDialog()) {
+        return;
+    }
+
+    int dlg = -1;
+    sscanf(args, "%d", &dlg);
+    if (dlg == -1) {
+        // Remove last entry
         Dialog::dialogs.pop_back();
         Dialog::dialogs.pop_back();
+        return;
     }
     }
+
+    if (dlg >= int(Dialog::dialogs.size())) {
+        // Invalid index, abort
+        return;
+    }
+
+    // Erase given index, higher indexes will be decreased by 1
+    Dialog::dialogs.erase(Dialog::dialogs.begin() + dlg);
 }
 
 void ch_dhs(const char*)
 }
 
 void ch_dhs(const char*)
index eb90dde73aba420263870a78e6555edc42698c3c..a4445c9b5b28b1a76bfe332da4a19e08be73b541 100644 (file)
@@ -70,9 +70,9 @@ DECLARE_COMMAND(type)
 DECLARE_COMMAND(path)
 DECLARE_COMMAND(hs)
 DECLARE_COMMAND(dhs)
 DECLARE_COMMAND(path)
 DECLARE_COMMAND(hs)
 DECLARE_COMMAND(dhs)
-DECLARE_COMMAND(dialogue)
-DECLARE_COMMAND(fixdialogue)
-DECLARE_COMMAND(ddialogue)
+DECLARE_COMMAND(dialog)
+DECLARE_COMMAND(fixdialog)
+DECLARE_COMMAND(ddialog)
 DECLARE_COMMAND(fixtype)
 DECLARE_COMMAND(fixrotation)
 DECLARE_COMMAND(immobile)
 DECLARE_COMMAND(fixtype)
 DECLARE_COMMAND(fixrotation)
 DECLARE_COMMAND(immobile)