www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Software Development

Reply
 
Thread Tools
Old 09-01-15, 23:14   #1111
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 976
Default

Yes, I also have error 500 messages, so I can't even pull latest Nickotte's commit... We should really think of migrating to Github some day!
Lwmte is offline   Reply With Quote
Old 09-01-15, 23:53   #1112
Gh0stBlade
Archaeologist
 
Gh0stBlade's Avatar
 
Join Date: Dec 2010
Posts: 2,243
Default

Quote:
Originally Posted by Lwmte View Post
Yes, I also have error 500 messages, so I can't even pull latest Nickotte's commit... We should really think of migrating to Github some day!
Yeah, it may also get some more attention. Perhaps a secondary repository could be held on Github so when SF goes down we don't have to keep waiting that way both are kept for those who prefer SF.

I'll wait until tomorrow I guess

Regards.
__________________
No longer accepting PMs due to abuse of the system.
Gh0stBlade is offline   Reply With Quote
Old 10-01-15, 00:30   #1113
Nickotte
Historian
 
Nickotte's Avatar
 
Join Date: May 2010
Location: Italy
Posts: 256
Default

Quote:
Originally Posted by Gh0stBlade View Post
Yeah, it may also get some more attention. Perhaps a secondary repository could be held on Github so when SF goes down we don't have to keep waiting that way both are kept for those who prefer SF.
I think that'd be a great idea. If you're sharing something on the Internet, you gotta remember you're never fail-safe enough. Also, yay for more attention!

Regarding the items, I find inventory_node_s are exactly what you describe, as the rendering-side part of the items, not the actual items; in fact, actual items would be base_item_s instead... am I wrong?

Code:
typedef struct inventory_node_s
{
    float                       mAng;
    float                       mAng2;
    uint32_t                    id;
    int32_t                     count;
    struct inventory_node_s    *next;
}inventory_node_t, *inventory_node_p;

...

typedef struct base_item_s
{
    uint32_t                    id;
    uint32_t                    world_model_id;
    uint16_t                    type;
    uint16_t                    count;
    char                        name[64];
    struct ss_bone_frame_s     *bf;
}base_item_t, *base_item_p;
I was thinking of adding to the inventory_node_s a couple of pointers to the ammo items, a check for the ring menu and a function to reorder the items once every inventory update. That way, I can leave everything as is and just write additional methods whenever we need to.
Nickotte is offline   Reply With Quote
Old 10-01-15, 01:48   #1114
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 976
Default

Umm... Not exactly, the whole base item vs. inventory item thing is a bit mess now, partly because I've placed a name into base item structure... It doesn't belong here! Especially as a static array.

The idea of base item is that on engine start-up, you register pick-upable items and define menu model ID, world model ID (which is mostly similar to menu model ID, but may be different in earlier versions of engine) and default number of items that goes into Lara inventory on pick-up - so when uzi ammo is picked up, amount of ammo is defined by base item count field.

So, base item is an entry which tells the engine how to process pick-ups in game, inventory node is ACTUAL item in Lara's inventory, and what I offer to do is to make additional struct which will deal with GUI representation of an item - we can store there all the rotations, names, size and other interface-specific options. We can populate array of these structs on entering inventory.

Adding pointers to ammo items could be confusing, as it's type-specific, then you also have to make pointers to possibly "combineable" items, etc. etc. That's why I offer you creating seperate array with gui representation of each inventory item. Anyway, it's only my point of view, maybe your method will be more consistent, so do what you think fit!

Last edited by Lwmte; 10-01-15 at 01:54.
Lwmte is offline   Reply With Quote
Old 10-01-15, 02:07   #1115
Nickotte
Historian
 
Nickotte's Avatar
 
Join Date: May 2010
Location: Italy
Posts: 256
Default

Mmmm, I think I understand... Doesn't sound half bad! I'll sure give it a try
Btw, SF seems to be fixed for the moment. Let me know if there are any near-future plans to make a GitHub repo, I think I'll copy my fork over there too ASAP.
Nickotte is offline   Reply With Quote
Old 10-01-15, 02:28   #1116
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 976
Default

Ok, sure! Anyway, it's TeslaRus who decides where to host a project, as it's his project after all!

P.S.: Also, besides of string manager, we now in urge to make some kind of font manager, because current setup keeps a font in console structure, which is awkward; also there is a strange double initialization of font, at first it initializes as hardcoded VeraMono.ttf, then it loads font path from script and initializes again, it puzzled me cause when I changed font in config file to Roboto, only console font actually changed, while inventory font remained VeraMono!

I think we can make fixed amount of font types, i. e. we know that usually game uses 1 or 2 fonts at max, so we can simply create static array with 2 or 3 fonts (one main font, one secondary font, and one for console), plus we can define unlimited amount of styles for each of them, like colour, shadow property and fade property (to create fading effect, like in TR4-5) - that's more flexible than your current setup with three hardcoded colour sets.

Here's a prototype for corresponding font enumeration, style struct and whole font manager class:

Code:
enum Fonts
{
    FONT_PRIMARY,
    FONT_SECONDARY,
    FONT_CONSOLE,
    FONT_LASTINDEX
};

typedef struct gui_fontstyle_s
{
    int     style_index;
    float   color[4];
    bool    fading;
    bool    shadow;
} gui_fontstyle_t, *gui_fontstyle_p;


class gui_FontManager
{
public:
    gui_FontManager();
    
    bool             SetFont(const int font_type, const char* font_path);
    FTGLTextureFont  GetFont(const int font_type);
    
    bool             AddFontStyle(const int style_index,
                                  const float R, const float G, const float B,
                                  const bool shadow, const bool fading);
    void             RemoveFontStyle(const int style_index);
    
    void             Update(); // Do fading routine here, etc.
    
private:
    bool             ClearFont(const int font_type); // Internally used by SetFont().
    float            mFadeValue; // Multiplier used with font RGB values to animate fade.
    uint32_t         style_count;
    gui_fontstyle_s *styles;
    FTGLTextureFont *fonts[FONT_LASTINDEX];
};
I hope you got the idea!

As for string manager... I think we should create subdirectory in /scripts folder named "strings" or "text", and put all string arrays there, for ex., create "menu_english.lua" (or put each language in a separate dir?) file and put all the menu related strings there. Later we will also need additional string arrays, like for game menus, notify pop-ups, subtitles etc., so we put corresponding string files in corresponding language subdirectories... Or just make single .lua file named "interface_strings_english.lua", and place ALL interface text here!

Last edited by Lwmte; 10-01-15 at 02:35.
Lwmte is offline   Reply With Quote
Old 10-01-15, 02:53   #1117
Nickotte
Historian
 
Nickotte's Avatar
 
Join Date: May 2010
Location: Italy
Posts: 256
Default

Argh, fonts...! My archnemesis! __
Just kidding! I found that bug too. I can lend a help no problem... but I'll have to learn the basis first

What is a string manager, by the way? Oh and also, you said "static array" as in, fixed size, right? Are pointers capable of dynamic-size arrays? I have no clue about how they work.

EDIT: I see! Reading now: http://www.fredosaurus.com/notes-cpp...ynamalloc.html

Last edited by Nickotte; 10-01-15 at 03:02.
Nickotte is offline   Reply With Quote
Old 10-01-15, 08:18   #1118
Ado Croft
Historian
 
Join Date: Apr 2013
Posts: 267
Default Critical Bug

I have noticed there isn't room collision in (room id 76 in Crash Side level)
here is a video which shows the bug:

https://www.youtube.com/watch?v=It-J...ature=youtu.be
Ado Croft is offline   Reply With Quote
Old 10-01-15, 09:43   #1119
Lwmte
Explorer
 
Lwmte's Avatar
 
Join Date: Aug 2010
Posts: 976
Default

Quote:
Originally Posted by Nickotte
What is a string manager, by the way?
I have no idea yet, just called it randomly like that! I mean, we shoud somehow get needed strings from the script, and straightforward way like hardcoded strings is a no go if we want customization, so some way has to be invented to get needed string from Lua script. We can use a function lua_GetGlobalString similar to already existing lua_GetSoundtrack function (see script.cpp file), which takes second argument as desired track index (one from CD trigger) and returns full file path to the third argument (which is a pointer to char array).

So, we just define a bunch of numerical constants like this:

Code:
enum GlobalStringIndex
{
    GLOBALSTRING_INV_TITLE,
    GLOBALSTRING_INV_USE,
    GLOBALSTRING_INV_COMBINE,
    GLOBALSTRING_INV_EXAMINE,
    GLOBALSTRING_INV_EQUIP,
    GLOBALSTRING_INV_CHOOSEAMMO,
    GLOBALSTRING_LASTINDEX,
}
And then create Lua script file like this:

Code:
global_string_array = {};

global_string_array[000] = "INVENTORY";
global_string_array[001] = "Use";
global_string_array[002] = "Combine";
global_string_array[003] = "Examine";
global_string_array[004] = "Equip";
global_string_array[005] = "Choose ammo";
Then we call our lua_GetGlobalString function, which takes numerical index for string and returns a pointer to actual string extracted from script environment. This way we can easily customize strings via Lua script, and also add as many strings as we want without modifying source code.

For example, calling lua_GetGlobalString(engine_lua, GLOBALSTRING_INV_CHOOSEAMMO, flie_path) should return pointer to "Choose ammo" string into file_path variable.

Quote:
Oh and also, you said "static array" as in, fixed size, right? Are pointers capable of dynamic-size arrays? I have no clue about how they work.
I know very little about it myself, mostly I learn stuff from existing TeslaRus code. So what he commonly does is define a pointer variable, which is then could be used to store a pointer to the allocated array created with malloc and/or realloc functions. While malloc can be used to allocate fixed memory, realloc can be used to move existing memory block to larger/smaller memory space if needed. Not sure how to manage deleting of existing font styles... We can make same system as with inventory nodes, or just make a function like this:

Code:
bool gui_FontManager::RemoveFontStyle(const int style_index)
{
    if(style_count <= 1) return false; // We need at least one font style!
    
    font_style_p current_style = styles;
    
    for(int i=0; i<style_count; i++, current_style++)
    {
        if(current_style.style_index == style_index)
        {
            style_count--;
            memcpy(current_style+1, current_style, style_count-i);
            styles = (font_style_p)realloc(styles, style_count * sizeof(font_style_t));
            return true;
        }
    }
    
    return false;
}
While function is a very straightforward (it simply finds desired font style, moves memory block after it right over it and then reallocates memory block on a space one unit less than previous font style array), there should be not so many font styles, and function will be called rarely. Not sure if it will work correctly though!

Quote:
Originally Posted by Ado Croft
I have noticed there isn't room collision in (room id 76 in Crash Side level)
here is a video which shows the bug:
Well, VERY strange... Also it seems that walls are OK, while floor is missing... Perhaps, something is wrong with Bullet? I'll report that to TeslaRus (although I think he already saw it here! ).

Last edited by Lwmte; 10-01-15 at 10:25.
Lwmte is offline   Reply With Quote
Old 10-01-15, 17:15   #1120
Gh0stBlade
Archaeologist
 
Gh0stBlade's Avatar
 
Join Date: Dec 2010
Posts: 2,243
Default

Inventory protoype is working very well

I appear to be getting crashes on the latest build whilst switching between levels. The ones in question were LEVEL2-> LEVEL3B-> LEVELX(Crashes).

Great work!
__________________
No longer accepting PMs due to abuse of the system.

Last edited by Gh0stBlade; 10-01-15 at 17:18.
Gh0stBlade is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 19:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.