Journal task

Everything about development and the OpenMW source code.
Post Reply
User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Journal task

Post by gus » 11 Oct 2011, 16:33

I've a very simple question: I want that when i press 'j' the journal open. Where should I add the code about the 'j' key?
Last edited by gus on 17 Oct 2011, 21:24, edited 1 time in total.

User avatar
Star-Demon
Posts: 73
Joined: 11 Aug 2011, 03:17
Location: New York
Contact:

Re: Jounal task

Post by Star-Demon » 11 Oct 2011, 18:20

inputmanager.cpp

Code: Select all

enum Actions
    {
      A_Quit,           // Exit the program

      A_Screenshot,     // Take a screenshot

      A_Inventory,      // Toggle inventory screen

      A_Console,        // Toggle console screen

      A_MoveLeft,       // Move player left / right
      A_MoveRight,
      A_MoveForward,    // Forward / Backward
      A_MoveBackward,

      A_Activate,

      A_Use,        //Use weapon, spell, etc.
      A_Jump,
      A_AutoMove,   //Toggle Auto-move forward
      A_Rest,       //Rest
      A_Journal,    //Journal
      A_Weapon,     //Draw/Sheath weapon
      A_Spell,      //Ready/Unready Casting
      A_AlwaysRun,  //Toggle Always Run
      A_CycleSpellLeft, //cycling through spells
      A_CycleSpellRight,
      A_CycleWeaponLeft,//Cycling through weapons
      A_CycleWeaponRight,
      A_ToggleSneak,    //Toggles Sneak, add Push-Sneak later
      A_ToggleWalk, //Toggle Walking/Running

      A_QuickSave,
      A_QuickLoad,
      A_QuickMenu,
      A_GameMenu,

      A_LAST            // Marker for the last item
    };
Action is described in there. I suppose you'd add in in that file.
"The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane." - Nikola Tesla

User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Re: Jounal task

Post by gus » 11 Oct 2011, 18:40

Thanks Star!

User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Re: Journal task

Post by gus » 17 Oct 2011, 21:27

A little update: I've done some preliminary work: the J key is now binded to a new window.
The real task starts now (ie display the journal in that window).

User avatar
Zini
Posts: 5537
Joined: 06 Aug 2011, 15:16

Re: Journal task

Post by Zini » 21 Oct 2011, 08:08

I don't see any of your code on github yet. Any more progress? (okay, I know it's only 4 days since your last posting, but I am spoiled from the rapid progress with the mwrender refactoring).

User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Re: Journal task

Post by gus » 21 Oct 2011, 13:51

I haven't commited my change yet (as it's still messy). There has been a few progress since last time, but not that much. I'm stuck because i don't know how to display a list of string with MyGUI, but I asked in MyGUI forum, and i hope I will have an answere soon.

BTW, to start with, i will do a very simple journal: a scrollable journal, with all entry at the same place. (I don't know if I'm very clear^^)
(okay, I know it's only 4 days since your last posting, but I am spoiled from the rapid progress with the mwrender refactoring).
:lol:

User avatar
Zini
Posts: 5537
Joined: 06 Aug 2011, 15:16

Re: Journal task

Post by Zini » 21 Oct 2011, 14:50

Okay. Keep in mind that you need to render to four different targets: journal pages, book pages (different task, but at least the layout code should be reusable), scrolls (different task too) and layouting for previous journal pages (the journal opens on the last page; you need to layout all previous pages to determine the page number and what the first entry is).

I good method to handle these requirements is to split the functionality into two classes:

- a render target: a base class that can be specialised for each of the cases listed above

- a layouter: operates on a render target and has a layout-function, which takes a journal entry as argument and calls the various functions of the render target (e.g. getWidth, getHeight, addText, addPicture, newPage).

But it is ultimately up to you how you want to implement it.

User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Re: Journal task

Post by gus » 21 Oct 2011, 15:18

What you propose is much more complicated than what I had in mind.
If I understand well, we should do something different than morrowind journal (as it was pretty bad).

So I had in mind a very simple design (which is IIRC the same than oblivion):

Code: Select all

Quest                         Entry:
*quest1      s                   *entry1        s
*            c                   *              c
*            r                   *              r
*            o                   *              o
*            l                   *              l
*questn      l                   *entrym        l
And when you click on a quest (for exmple quest1) you get the entrys related to the quest.

Is it OK?
As with this implementation, none of the code would be reusable for books and scroll

User avatar
Zini
Posts: 5537
Joined: 06 Aug 2011, 15:16

Re: Journal task

Post by Zini » 21 Oct 2011, 15:38

We can improve the usability of the journal GUI, but we should not cut out features. As such implementing the chronological view is a must (and AFAIR Oblivion supports this too).
Reusability of the layout code is important. We may decide at some point to add additional layout features. If we have separate code for journal, books and scrolls. we would need to duplicate these improvements for each GUI.

User avatar
gus
Posts: 390
Joined: 11 Aug 2011, 15:41

Re: Journal task

Post by gus » 23 Oct 2011, 15:47

I understand uniting book and journal, but scroll is pretty different no? (do not really remember).

But well, I will focus on the journal class for now, and when it's done, i will create a common interface for book/journal at least, and maybe scrolls. But it might take some time: as star pointed out, there is very little documentation for MyGUI.

Post Reply