[Help] Color selection

Junior Spellweaver
Joined
Apr 2, 2016
Messages
120
Reaction score
76
Hi,

Crosshair color
Code:
r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]white[/B][/COLOR], scopeConfig->reticule);

Used for options change color

I saw that snippet from LukasCBB, not a lot of ppl know that so it is pretty useful to share, I thought about color change option (like on NewZ and InfectZ for example), I didn't try yet to code it but I think about it and explore some code from the Frondend script of InfectZ, what is the best way to do that,

Use this ?
Code:
r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]white[/B][/COLOR], scopeConfig->reticule);
with case like Red -> Case = 0 , Green -> Case = 1
and make something like that

Code:
        case 0:
            r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]red[/B][/COLOR], scopeConfig->reticule);
            break;
        case 1:
            r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]green[/B][/COLOR], scopeConfig->reticule);
            break;
        case 2:
            r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]yellow[/B][/COLOR], scopeConfig->reticule);
            break;
         ....
        default:
            r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::[COLOR=#ff0000][B]white[/B][/COLOR], scopeConfig->reticule);
            break;

And I don't know how to add these color icons (instead or text) on the flash project,
Extract from InfectZ Frontend (this is an example and a part from the script, OptionsGeneral)

And I guess if that system could works, would be the same for item loot color and spawn color.


[This post is a "tips and chat", not a post to have the entire solution without thinking, will take away some copy pasta mind.]

Sorry for that english,
FrageDev
 
Use this

Code:
else if( d_color_crosshair->GetInt() == 0 && scopeConfig->reticule)
                    {
                        float rw = (float)scopeConfig->reticule->GetWidth();
                        float rh = (float)scopeConfig->reticule->GetHeight();
                        float yy = g_camera_mode->GetInt() == 1?cy2:cy;
                        r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::white, scopeConfig->reticule);
                    }
    
    else if( d_color_crosshair->GetInt() == 1 && scopeConfig->reticule)
                    {
                        float rw = (float)scopeConfig->reticule->GetWidth();
                        float rh = (float)scopeConfig->reticule->GetHeight();
                        float yy = g_camera_mode->GetInt() == 1?cy2:cy;
                        r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::orange, scopeConfig->reticule);
                    }
else if( d_color_crosshair->GetInt() == 2 && scopeConfig->reticule)
                    {
                        float rw = (float)scopeConfig->reticule->GetWidth();
                        float rh = (float)scopeConfig->reticule->GetHeight();
                        float yy = g_camera_mode->GetInt() == 1?cy2:cy;
                        r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::blue, scopeConfig->reticule);
                    }
else if( d_color_crosshair->GetInt() == 3 && scopeConfig->reticule)
                    {
                        float rw = (float)scopeConfig->reticule->GetWidth();
                        float rh = (float)scopeConfig->reticule->GetHeight();
                        float yy = g_camera_mode->GetInt() == 1?cy2:cy;
                        r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::green, scopeConfig->reticule);
                    }
else if( d_color_crosshair->GetInt() == 4 && scopeConfig->reticule)
                    {
                        float rw = (float)scopeConfig->reticule->GetWidth();
                        float rh = (float)scopeConfig->reticule->GetHeight();
                        float yy = g_camera_mode->GetInt() == 1?cy2:cy;
                        r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, r3dColor::red, scopeConfig->reticule);
                    }

And make this var in source and flash d_color_crosshair
 
Last edited:
Upvote 0
Also it is possible to replace "r3dColor::blue" by a variable and make a smaller condition like ?
with case 0 color = r3dColor::red ...
r3dDrawBox2D(float(cx-(rw/2)), float(yy-(rh/2)), rw, rh, color, scopeConfig->reticule);





 
Upvote 0
I end my rainbow six game and I'm gonna start to work on it, maybe we will relase nobody know or deserv, I higly pref to let a "dev post" than a full tutorial.

This is more enjoyable and educational, for ppl like me who know nothing about C++ (not a C++ brain like other DEV :D) and try to learn on my free time (not a lot atm :'( )
 
Last edited:
Upvote 0
Watch the footer of the site and see people viewing this post, not being able to help, and still waiting for a tutorial explained, haha, I'm laughing too.


FrageDev
It's working, I'll adjust some things, and I will send to you via private.

FrageDev - [Help] Color selection - RaGEZONE Forums




FrageDev - [Help] Color selection - RaGEZONE Forums
 
Upvote 0
Back