Basic Half-Life Map Support For Stock GLQuake

Post tutorials on how to do certain tasks within game or engine code here.
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

@mexicouger - yeah, its another texture thats been altered from the original. i wish decal textures worked though, you can do some cool stuff with them some times.

@baker, if you want to set up alpha textures for hlbsp how they do it is the take the color out of the pallete which is #255 and if the texture is set to func_illusionary and a certain value which i dont remeber is off hand is set to 255 then it's transparent if you can do that. then that would be awesome.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

ceriux wrote:@baker, if you want to set up alpha textures for hlbsp how they do it is the take the color out of the pallete which is #255 and if the texture is set to func_illusionary and a certain value which i dont remeber is off hand is set to 255 then it's transparent if you can do that. then that would be awesome.
You threw me off with the TGA alpha channel thing in your other thread.

This palette 255 = transparent feature may be something you get tonight, btw.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

really? wow that would be awesome =) then i wont have to bother with tga's. at least not till i get to some models.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Upload your map, I think I have this done. Except I have no test case map.

Nevertheless, I need to do some finishing touches.
ceriux wrote:really? wow that would be awesome =) then i wont have to bother with tga's. at least not till i get to some models.
Ahem. FitzQuake doesn't load external textures of q1 mdl as far I know, just bsps.

Of course, that can be changed :D
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

my map isnt setup to have hl's texture to be transparent, but i can update it to do that. just have to figure out how to find which color is the 255 color.
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

ceriux wrote:my map isnt setup to have hl's texture to be transparent, but i can update it to do that. just have to figure out how to find which color is the 255 color.
The dark pink one. In Wally it's the last colour (lowest right).
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

each pallet is different, since each textures are different. i know i can change it to the one i want i just have to figure out how to do it with out messing the picture up because of a pallet shift.
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

Okey i have a way to add Alpha channel:

Go to "Mod_LoadTextures" and before add:
qboolean hl_map;

then go to the line: "if (loadmodel->bspversion == HL_BSPVERSION) { ..." and add here after "byte *data;":
tx->transparent = false;
hl_map = true;


in "if ((data = WAD3_LoadTexture(mt))) {"
you add first:

if (tx->name[0] == '{')
tx->transparent = true;


change now the "GL_LoadTexture32" to:
tx->gl_texturenum = GL_LoadTexture32 (mt->name, tx->width, tx->height, (byte *)data, true, tx->transparent);

okey now we are done in here no open the "gl_rsurf.c" and
go to "R_DrawBrushModel"

before "void" add:
extern qboolean hl_map;

no go to in the void and add after "glColor3f (1,1,1);":
if (hl_map) {
glColor4f (1, 1, 1, 1);
glEnable(GL_ALPHA_TEST);
}


In "gl_model.h" find: "typedef struct texture_s"

add at end of the struct:
int transparent;
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

with that, which color would make it transparent?
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

The last color of the 255 palett in most hl textures is it the BLUE color
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

ahh ic, well it doesnt have to be blue, its which ever the last color is reguardless. but if this works i suppose it would save baker a lot of time.
Rikku2000
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany
Contact:

Post by Rikku2000 »

I thing it will work a and i edit the WAD3 Convertion its from Tomaz Quake:

Code: Select all

static byte *ConvertWad3ToRGBA(miptex_t *tex) {
	byte	*in, *data, *out, *pal;
	int		d, p;

	in		= (byte *)((int) tex + tex->offsets[0]);
	data	= out = malloc(tex->width * tex->height * 4);

	if (!data)
		return NULL;

	pal				= in + (((tex->width * tex->height) * 85) >> 6);
	pal				+= 2;

	for (d = 0;d < tex->width * tex->height;d++) {
		p = *in++;
		if (tex->name[0] == '{' && p == 255)
			out[0] = out[1] = out[2] = out[3] = 0;
		else {
			p *= 3;
			out[0] = pal[p];
			out[1] = pal[p+1];
			out[2] = pal[p+2];
			out[3] = 255;
		}
		out += 4;
	}
	return data;

}
On my Engine looks like this:
Image
Post Reply