View previous topic :: View next topic |
Author |
Message |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Tue Nov 18, 2008 4:18 am Post subject: in-need if messing around experience |
|
|
Baker told me @ QuakeOne.com :
Quote: | you'd probably need to get help @ Inside3d.com because messing around always requires experience. |
and well, now I'm here [scary being away from the qc forum]
i did the tutorial that makes the explosions have a blue light ( http://www.quake-1.com/docs/quakesrc.org/94.html )
and i was wondering how would i be able to make it more orange, but not the normal yellow [otherwise i wouldn't have done tutorial ]
i guessing it involves messing with the Numbers around here
Code: | // CDL - epcaATpowerupDAWTcomDAWTau <- had to break the link
// Make the dynamic light purple
dl->colour[0] = 0.2; dl->colour[1] = 0.2; dl->colour[2] = 0.8;
// CDL
|
but i don't wanna break the engine again [ i count 76-107 errors not evolving a misspelling or a missing ";" as breaking]
also [risking making this thread to bossy/long]
is this a tutorial that allows the engine to use "dpextensions.qc"?
http://www.quake-1.com/docs/quakesrc.org/140.html
i hate to be a forum jumper and this is the thread that started it:
http://www.quakeone.com/forums/showthread.php?t=4016
any help is cool 8O _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Nov 18, 2008 3:32 pm Post subject: Re: in-need if messing around experience |
|
|
MeTcHsteekle wrote: |
dl->colour[0] = 0.2; dl->colour[1] = 0.2; dl->colour[2] = 0.8;
|
Those are your RGB light colors.
The first color = red (0)
Second = green (1)
Third = blue (2)
Yellow would be almost no red and strong green and blue, like 0.2 0.8 0.8.
Orange is strong red and around half green with about no blue, like 0.8 0.4 0.2 or maybe try [0.8 0.4 0.0].
Here is a quick Googling of an RGB color table for you:
http://cloford.com/resources/colours/500col.htm
And that other tutorial adds an extension system into an engine. An empty one!
So, no, it wouldn't allow you to use DarkPlaces extensions because you would need to individually add code and functionality to the engine to support those.
Another engine that supports a ton of extensions is FTEQW and neither DarkPlaces nor FTEQW support all of each other's extensions ... largely because some of them are very complicated and difficult to implement.
And #2: As a general rule of thumb, almost no extensions are tutorialized. There is one, frik_file which allows QuakeC to read and write files.
Some of the extensions are simple math functions or minor effects support ... while other extensions are very complex.
I'm not big on the QuakeC side of things and have personally not used an extension in QuakeC, but the concept of extensions is that the engine lets it be known whether or not the extension is available to the QuakeC side of things.
Think of extensions as a expansion slot system. Doing that tutorial would create that and that alone, so when you are done you'd have an expansion slot system ... but no slots are filled. |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Tue Nov 18, 2008 10:41 pm Post subject: Re: in-need if messing around experience |
|
|
Baker wrote: |
Those are your RGB light colors.
The first color = red (0)
Second = green (1)
Third = blue (2)
Yellow would be almost no red and strong green and blue, like 0.2 0.8 0.8.
Orange is strong red and around half green with about no blue, like 0.8 0.4 0.2 or maybe try [0.8 0.4 0.0].
|
Actually yellow can be obtained by combining red and green
I suggest MeTcHsteekle to take a look for example in the standard color selection dialog in Windows background settings and play with the controls to find out the tone he wants to apply. The values that appears as red, green and blue can then be divided by 255 to obtain the required ones (in floating point notation) by OpenGL. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Wed Nov 19, 2008 1:54 am Post subject: |
|
|
hehe , thanks for the help cos now i have the orange i want
now i can go through and add other colors to things as well [ill try not to make it look to colorful though]
so if i do the extension tutorial, id have to hope that LordHavoc doesn't 86 this thread to get the DP ones?
//or i can try and fumble through the DP source
.. hmm i guess i could have asked this on q1.com after all _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Wed Nov 19, 2008 4:01 am Post subject: |
|
|
DarkPlaces code is radically different from GLQuake/WinQuake. It has about 8 years of changes in it. (Last I heard, 97% of it is entirely rewritten from GLQuake).
For someone just starting to learn engine coding, it would be like skipping to end of an advanced calculus textbook without doing any of the middle of the book.
There is a lot of material in those Quakesrc.org tutorials and comparing an contrasting engines like GLQuake vs. FitzQuake vs. aguirRe Quake vs. JoeQuake is a good place to start.
If you really want to learn about EBFS, do the EBFS tutorial and the FrikFile tutorial.
Here is a very simple and generic ProQuake with EBFS added by RocketGuy that also has Frik_File (download).
I've not used it, but RocketGuy runs it on his RQuake server so it must be stable.
Above and beyond that, the QuakeSrc.org tutorials are a great place to start because they help you understand.
If you want to try to understand DarkPlaces and the extension system, you'd probably be best off using WinMerge to compare different old DarkPlaces version back when DarkPlaces was far more similar to original Quake.
Like such:
http://icculus.org/twilight/darkplaces/files/2000/
I'd recommend #104
http://icculus.org/twilight/darkplaces/files/2000/darkplacesengine104.zip |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Thu Nov 20, 2008 3:42 am Post subject: |
|
|
EBFS != checkextension _________________ What's a signature? |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Wed Nov 26, 2008 11:57 pm Post subject: |
|
|
hmm alright ill just hold back on the dp stuff, and csqc.
but ATM ima having trouble with pcx ant tga loading textures tut
http://www.quake-1.com/docs/quakesrc.org/101.html
and around the time i read this Quote: | THATS IT...
And as a bonus cos i screwed up u also get to know how to get TGA and PCX on models!!!! |
i kind of lost confidence, in it and im getting alot of stuff
Quote: | --------------------Configuration: winquake - Win32 GL Release--------------------
Compiling...
gl_draw.c
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1803) : error C2065: 'column0' : undeclared identifier
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1807) : error C2181: illegal else without matching if
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1823) : error C2065: 'j' : undeclared identifier
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1823) : error C2143: syntax error : missing ';' before ')'
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1823) : warning C4550: expression evaluates to a function which is missing an argument list
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1827) : error C2181: illegal else without matching if
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1837) : error C2059: syntax error : '}'
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1843) : error C2059: syntax error : '}'
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1851) : error C2065: 'columns' : undeclared identifier
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1851) : error C2099: initializer is not a constant
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1853) : error C2065: 'rows' : undeclared identifier
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1853) : error C2099: initializer is not a constant
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1855) : error C2059: syntax error : 'return'
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1857) : error C2059: syntax error : '}'
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1927) : warning C4047: '=' : 'unsigned char *' differs in levels of indirection from 'int '
Error executing cl.exe.
glpro.exe - 13 error(s), 2 warning(s)
|
i tried fixing mos of them, but as i did it more kept forming  _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Thu Nov 27, 2008 2:48 am Post subject: |
|
|
MeTcHsteekle wrote: |
C:\Users\alex\Desktop\proquake\WinQuake\gl_draw.c(1803) : error C2065: 'column0' : undeclared identifier |
Looks like column0 variable isn't being defined.
And it doesn't like it is being defined in the tutorial either
As an alternative, I would replace the whole *byte Load_Tga(...) with this from aguirRe Quake:
Code: | #pragma pack(1)
typedef struct _TargaHeader {
unsigned char id_length, colormap_type, image_type;
unsigned short colormap_index, colormap_length;
unsigned char colormap_size;
unsigned short x_origin, y_origin, width, height;
unsigned char pixel_size, attributes;
} TargaHeader;
#pragma pack()
/*
=============
LoadTGA
=============
*/
static byte *LoadTGA (char *name, int *width, int *height, qboolean alphablend)
{
TargaHeader *targa_header;
FILE *f;
int columns, rows, numPixels;
byte *pixbuf, *buf;
byte *targa_rgba;
int row, realrow, column;
qboolean upside_down, alpha, blend;
char filename[MAX_OSPATH];
sprintf (filename, "%s.tga", name);
COM_FOpenFile (filename, &f);
if (!f)
return NULL;
if (com_filesize < sizeof(TargaHeader))
Sys_Error ("LoadTGA: can't read header in %s", filename);
targa_header = malloc (com_filesize);
if (!targa_header)
Sys_Error ("LoadTGA1: error allocating %d bytes for %s", com_filesize, filename);
if (fread (targa_header, 1, com_filesize, f) != com_filesize)
Sys_Error ("LoadTGA: error reading %s", filename);
fclose (f);
targa_header->width = SwapShort (&targa_header->width);
targa_header->height = SwapShort (&targa_header->height);
if (targa_header->image_type!=2
&& targa_header->image_type!=10)
Sys_Error ("LoadTGA: %s: only type 2 and 10 targa RGB images supported, not %d", filename, targa_header->image_type);
if (targa_header->colormap_type !=0
|| (targa_header->pixel_size!=32 && targa_header->pixel_size!=24))
Sys_Error ("LoadTGA: %s: only 24 and 32 bit images supported (no colormaps, type=%d, bpp=%d)", filename, targa_header->colormap_type, targa_header->pixel_size);
columns = targa_header->width;
rows = targa_header->height;
numPixels = columns * rows;
upside_down = !(targa_header->attributes & 0x20); // true => picture is stored bottom to top
targa_rgba = malloc (numPixels*4);
if (!targa_rgba)
Sys_Error ("LoadTGA2: error allocating %d bytes for %s", numPixels*4, filename);
blend = alphablend && gl_alphablend.value;
alpha = targa_header->pixel_size == 32;
buf = (byte *)(targa_header + 1);
if (targa_header->id_length != 0)
buf += targa_header->id_length; // skip TARGA image comment
if (targa_header->image_type==2) { // Uncompressed, RGB images
for(row=rows-1; row>=0; row--) {
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
ChkBounds ("LoadTGA1", buf - (byte *)targa_header + columns * targa_header->pixel_size / 8, com_filesize, filename);
ChkBounds ("LoadTGA2", pixbuf - targa_rgba + columns * 4, numPixels * 4, filename);
for(column=0; column<columns; column++) {
unsigned char red,green,blue,alphabyte;
blue = *buf++;
green = *buf++;
red = *buf++;
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha ? *buf++ : (blend ? (red + green + blue) / 3 : 255); // Better way?;
}
}
}
else if (targa_header->image_type==10) { // Runlength encoded RGB images
unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j;
for(row=rows-1; row>=0; row--) {
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
for(column=0; column<columns; ) {
packetHeader = *buf++;
packetSize = 1 + (packetHeader & 0x7f);
ChkBounds ("LoadTGA3", pixbuf - targa_rgba + packetSize * 4, numPixels * 4, filename);
if (packetHeader & 0x80) { // run-length packet
ChkBounds ("LoadTGA4", buf - (byte *)targa_header + targa_header->pixel_size / 8, com_filesize, filename);
blue = *buf++;
green = *buf++;
red = *buf++;
alphabyte = alpha ? *buf++ : (blend ? (red + green + blue) / 3 : 255); // Better way?;
for(j=0;j<packetSize;j++) {
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
column++;
if (column==columns) { // run spans across rows
column=0;
if (row>0)
row--;
else
goto breakOut;
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
}
}
}
else { // non run-length packet
ChkBounds ("LoadTGA5", buf - (byte *)targa_header + packetSize * targa_header->pixel_size / 8, com_filesize, filename);
for(j=0;j<packetSize;j++) {
blue = *buf++;
green = *buf++;
red = *buf++;
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alpha ? *buf++ : (blend ? (red + green + blue) / 3 : 255); // Better way?;
column++;
if (column==columns) { // pixel packet run spans across rows
column=0;
if (row>0)
row--;
else
goto breakOut;
realrow = upside_down ? row : rows - 1 - row;
pixbuf = targa_rgba + realrow*columns*4;
}
}
}
}
breakOut:;
}
}
*width = targa_header->width;
*height = targa_header->height;
free (targa_header);
return targa_rgba;
} |
Now the above expects a 4th parameter ... so set that to 1.
And it appears you would need this as well:
Code: | static unsigned short SwapShort (unsigned short *SVal)
{
byte *Buf = (byte *)SVal;
return (unsigned short)(Buf[0] + Buf[1] * 256);
}
static void ChkBounds (char *Function, int Val, int MaxVal, char *FileName)
{
if (Val > MaxVal)
Sys_Error ("%s: invalid buffer access (%d, max = %d) in %s", Function, Val, MaxVal, FileName);
} |
These should for the purpose of simplicity be above the LoadTga function.
Last edited by Baker on Thu Nov 27, 2008 3:03 am; edited 5 times in total |
|
Back to top |
|
 |
ceriux

Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA
|
Posted: Thu Nov 27, 2008 2:50 am Post subject: |
|
|
why not look at the darkplaces source and see what you can while looking through the tutorial, you could probably see how they defined it and where. _________________ QuakeDB - Quake ModDB Group |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Thu Nov 27, 2008 3:15 am Post subject: |
|
|
hmm that's a good idea, or maybe i should start at tomaz quake?
i believe im looking for a "#define column0 ###"
oh ya never do a search for "E" in the qrack source
Quote: | 65745 occurrence(s) have been found. |
!!!!realizes he missed 95% of bakers post
oh does that code require your alpha support tutorial? because i haven't gotten to that one yet, and this tga/pcx ones has been at the top of my browser for half a month now _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Thu Nov 27, 2008 3:53 am Post subject: |
|
|
MeTcHsteekle wrote: |
oh does that code require your alpha support tutorial? |
Nope, has nothing to do with it.
Some of the tutorials at the QuakeSrc.org don't quite work, per se. I think you found one of them. |
|
Back to top |
|
 |
MeTcHsteekle
Joined: 15 May 2008 Posts: 397 Location: its a secret
|
Posted: Sat Nov 29, 2008 2:18 am Post subject: |
|
|
ok thanks for the heads up that "there could be more (NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO)"
ill just have to read thru more careful next time
now i have rid my code of its terrible errors  _________________ bah |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Sat Nov 29, 2008 11:16 am Post subject: |
|
|
Create a folder where you'll keep all of your engine stuff.
I use e:\engine
Create a functional copy of a compile-ready stock id1 Quake.
I use e:\engine\locked-quakereal
Right click the folder and do Properties -> "read-only".
When you want to do experiments, copy the folder and right click it and remove the read only status.
Then do the tutorials you can or play with WinMerge against different fairly faithful (and hence, not completely rewritten) engines like:
1. ProQuake 3.50 (easiest to work with, no graphics changes).
2. FitzQuake (2nd easiest to work with, few non-graphics changes except console and cvar callback)
3. Enhanced GLQuake (3rd easiest to work with)
4. QIP Quake (has some interesting fixes in it)
5. JoeQuake 0.14 (in most ways, the cleanest codebase for a baseline Quake)
6. Early DarkPlaces, like DarkPlaces 1.05 (*)
Get TextPad 5 or another more sophisticated text editor -- I like TextPad 5 because it does more while still using the "keep it simple" philosophy, and use Search -> Find in Files against your source codes a lot (be sure to set the filter to *.c; *.h; *.cpp; *.m).
Learning to modify the engine is hard because there are a lot of different sections. But the more you do, the more you understand. After a while, some things will start to become very obvious.
(*) That was some invaluable advice from MH I once got. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|