Forum

Basic Half-Life Map Support For Stock GLQuake

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

Postby ceriux » Sat Jan 29, 2011 5:20 am

@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.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Baker » Sat Jan 29, 2011 7:11 am

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby ceriux » Sat Jan 29, 2011 7:44 am

really? wow that would be awesome =) then i wont have to bother with tga's. at least not till i get to some models.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Baker » Sat Jan 29, 2011 11:00 am

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 ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby ceriux » Sat Jan 29, 2011 5:09 pm

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.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby dreadlorde » Sun Jan 30, 2011 6:50 am

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!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby ceriux » Sun Jan 30, 2011 6:56 am

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.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Rikku2000 » Sun Jan 30, 2011 4:34 pm

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;
User avatar
Rikku2000
 
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany

Postby ceriux » Sun Jan 30, 2011 8:10 pm

with that, which color would make it transparent?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Rikku2000 » Sun Jan 30, 2011 8:26 pm

The last color of the 255 palett in most hl textures is it the BLUE color
User avatar
Rikku2000
 
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany

Postby ceriux » Sun Jan 30, 2011 8:42 pm

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.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Rikku2000 » Sun Jan 30, 2011 8:50 pm

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
User avatar
Rikku2000
 
Posts: 49
Joined: Wed Oct 20, 2010 6:33 pm
Location: Germany

Previous

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest