Quake3World.com Forums
     Programming Discussion
        [CLIENTSIDE] locations of colors table and how to extend the


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: [CLIENTSIDE] locations of colors table and how to extend the

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 05-13-2012 08:23 AM           Profile Send private message  E-mail  Edit post Reply with quote


First: hi all and thanks!!
This is the first time i write here but i always checked and readed all your discussions here.

Now, i register myself here because i'm trying to finish my "little" mod but i still have some problems which i can't manage.
I precise i'm using only notepad so my big problem's ever Find where's stored what i need to change...

i need to add colors for text and chat elements
first of all i defined in q_shared the new colors bindings but actually... :

Where can i find the 7 main colors?
(i need to modify the value of RGBA on them too).

I'm adding a "ghost" model with custom shader which replay the player movements when he die.
The problem's that: i need to make it ever visible also behind walls.
i think i need only to add this thing on stored cgs.media.ghostshader but what i need to specify?

thanks a lot for your help




Last edited by 3xistence on 05-22-2012 04:10 AM, edited 1 time in total.

Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Mar 2010
Posts: 384
PostPosted: 05-13-2012 10:41 AM           Profile Send private message  E-mail  Edit post Reply with quote


I've also tried adding colors before but ended up with 0 - 7 alternating between red and black but 8 and 9 orange and purple as I wanted. I did it like you did in q_shared.h, but also defining the colors in g_color_table:

q_shared.h:
Code:
#define COLOR_BLACK      '0'
#define COLOR_RED      '1'
#define COLOR_GREEN      '2'
#define COLOR_YELLOW   '3'
#define COLOR_BLUE      '4'
#define COLOR_CYAN      '5'
#define COLOR_MAGENTA   '6'
#define COLOR_WHITE      '7'
#define COLOR_ORANGE   '8'
#define COLOR_PURPLE   '9'
#define ColorIndex(c)   (((c) - '0') & 0x09)

#define S_COLOR_BLACK   "^0"
#define S_COLOR_RED      "^1"
#define S_COLOR_GREEN   "^2"
#define S_COLOR_YELLOW   "^3"
#define S_COLOR_BLUE   "^4"
#define S_COLOR_CYAN   "^5"
#define S_COLOR_MAGENTA   "^6"
#define S_COLOR_WHITE   "^7"
#define S_COLOR_ORANGE   "^8"
#define S_COLOR_PURPLE   "^9"

extern vec4_t   g_color_table[10];


q_math.c:
Code:
vec4_t   g_color_table[10] =
   {
   {0.0, 0.0, 0.0, 1.0},
   {1.0, 0.0, 0.0, 1.0},
   {0.0, 1.0, 0.0, 1.0},
   {1.0, 1.0, 0.0, 1.0},
   {0.0, 0.0, 1.0, 1.0},
   {0.0, 1.0, 1.0, 1.0},
   {1.0, 0.0, 1.0, 1.0},
   {1.0, 1.0, 1.0, 1.0},
   {1.0, 0.5, 0.0, 1.0},
   {0.5, 0.0, 0.5, 1.0},
   };


I figured out that the colors are possibly limited to the 8 colors of ascii escape codes. ioquake3 has the following function in sys_main.c:

Code:

/*
=================
Sys_AnsiColorPrint

Transform Q3 colour codes to ANSI escape sequences
=================
*/
void Sys_AnsiColorPrint( const char *msg )
{
   static char buffer[ MAXPRINTMSG ];
   int         length = 0;
   static int  q3ToAnsi[ 8 ] =
   {
      30, // COLOR_BLACK
      31, // COLOR_RED
      32, // COLOR_GREEN
      33, // COLOR_YELLOW
      34, // COLOR_BLUE
      36, // COLOR_CYAN
      35, // COLOR_MAGENTA
      0   // COLOR_WHITE
   };

... SNIP ...

            // Print the color code
            Com_sprintf( buffer, sizeof( buffer ), "\033[%dm",
                  q3ToAnsi[ ColorIndex( *( msg + 1 ) ) ] );

... SNIP ...

}


Well that's all I've got I'm afraid. I would also like to see if anyone knows wtf is going on.




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 05-13-2012 12:50 PM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks a lot, i tried to make the same thing plus or less: i changed
#define ColorIndex(c) (((c) - '0') & 7)
the original one with
#define ColorIndex(c) (((c) - '0') & 11)
(don't know if actually it works.

for little changes in colors the engine works with 1=255 so i put colors like
{0.0, 0.6, 0.6, 1}, etc...
thanks for q_math.c file I will try and let you know if i success.
My question's because mod like OSP or CPMA have more colors without using the "bug free" code of ioquake. Right about now i'm trying to use original source of q3a with modded exe of openarena and see if all works.

My mod's simply at the last: i'm trying to create a sort of ALL-IN-ONE mod for quake 3 arena able to be used in this times of Quake Live etc...
The most Complete mod i saw is Excessive plus ++ (with the customizable hud). I'm doing something like quake live experiece (like customized rail recharge color etc...) with some new feature like a sort of defrag where you can see your ghost and understand your mistakes. The project's maybe a little ambitious. But actually i tried quake live and i'm a little disappointed for modern players. I don't care about 1ctf or other modes, but i want to put Clan Arena and freeze tag (source free) as gametype selectable from menu and instagib and air control physics (like CPMA) from callvote so server side. Right about now i coded hud (but not customizable), some graphic effects, maps (for who doesn't know..all maps of quake live are actually free in their version q3a (before to be modded for quake live they are quake 3 arena only maps or quake 3 dreamcast maps [ever downloadable for free]). thanks muffin. If you are still playing, give me your nick




Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Mar 2010
Posts: 384
PostPosted: 05-13-2012 02:17 PM           Profile Send private message  E-mail  Edit post Reply with quote


lol my mod's also a QL-inspired all-in-one, overly-ambitious project. Got most of the cvars added and working, rulesets, menudefs, instagib added. The player physics features are mostly there and framerate independant movement, upgraded voting system, weapon bars and other hard-coded UI elements, game states and readyup system, auto-action, truetype font etc.. The goal is to eventually have it run for both Q2 and Q3, through the same client but obviously with different vm's and assets to cater to the 2 very different games. Development just moves at a snail's pace since my terrible coding skills means that most big additions bring another 10 bugs to try and fix, but I'm getting there. Maybe one day when we both have decent alpha/beta releases we can join forces!

Yeah I play QL but I'll be pinging high from wherever you are.




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 05-13-2012 10:30 PM           Profile   Send private message  E-mail  Edit post Reply with quote


You might want to start using Visual Studio Express instead of notepad. I couldn't imagine doing any coding in notepad to be honest. That would be downright scary.

Visual Studio 2010 Express is a free version of the Visual Studio 2010 development environment. It will make your programming life a lot easier.




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 05-13-2012 11:14 PM           Profile Send private message  E-mail  Edit post Reply with quote


I downloaded it, i will install VS2010 soon.
aww, you are really near the goal (i think the big problem's, like you said, merge Q2 and Q3 through the same client.).
I need to implement the readyup,the font (still using the bigchars .tga) and all the rest so my project's just at the start point.
And if i remember well you merged the team arena with baseq3 right?


There are too much mods around, the only one i think's the most complete's EXcessive++.




Top
                 

Warrior
Warrior
Joined: 13 May 2012
Posts: 90
PostPosted: 07-02-2012 11:09 PM           Profile Send private message  E-mail  Edit post Reply with quote


Testing now, maybe i find a way to extend the color table




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.