.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Other SDKs (http://forums.bots-united.com/forumdisplay.php?f=63)
-   -   HL1 For other platforms? (http://forums.bots-united.com/showthread.php?t=4417)

sfx1999 04-09-2005 20:22

Re: HL1 For other platforms?
 
I thought the palette size was 256*3. If it is 256*2, then the format would be RRRRRGGGGGGBBBBB. That is a little bit more complicated to convert. It would be like this:

red = ((entry >> 9) * 255 / 31;
green = ((entry << 5) >> 10) * 255 / 63;
blue = ((entry << 11) >> 11) * 255 / 31;

BTW, some textures are in WADs. It appears that the ones in WADs have no offset.

Lazy 05-09-2005 01:38

Re: HL1 For other platforms?
 
I think it means 256 entries of 3 bytes, but thats working now I have a pointer to the palette.
The only problem now is converting it to a bitmap, I have next to no experience with images so this will take me a bit longer to figure out.

I think its something like...
u32 Pixel = SDL_MapRGB( format, palette[ pixel_data[ i ] ], palette[ pixel_data[ i + 1 ] ], palette[ pixel_data[ i + 2 ] ] );

Btw, this is in a seperate app now as I want to make sure it works before trying it in quake.
Unfortunately I get nothing but garbage in the screen.

sfx1999 05-09-2005 01:59

Re: HL1 For other platforms?
 
Damn it happened again!

Anyway, use the data of a texture to look up an entry in the palette. Make sure you do it three times; one for each color. Then just copy it into wherever it needs to go. Also, make sure that you aren't accidentally mixing up length and width. I've done that before.

Lazy 05-09-2005 09:18

Re: HL1 For other platforms?
 
Well, the darkplaces engine supports both half-life BSPs and wad3 files aswell as some pretty nice rendering enhancements like bloom, realtime lighting, ect...
I really should have looked harder to find a pre-made engine to use lol.

Rick 12-09-2005 16:22

Re: HL1 For other platforms?
 
Quote:

Originally Posted by Lazy
Well, the darkplaces engine supports both half-life BSPs and wad3 files aswell as some pretty nice rendering enhancements like bloom, realtime lighting, ect...
I really should have looked harder to find a pre-made engine to use lol.

So...are you going to use that engine?

[edit]
I just tried an esf map with Nexuiz (a game which uses the darkplaces engine) and it worked :)
Well the skybox was missing, but maybe I had to copy another file.

Lazy 12-09-2005 18:04

Re: HL1 For other platforms?
 
The really big problem which stands in the way of this working is quakec...
Important entities such as multi_manager have custom key/value pairs which get ignored by the engine.
I added in something to call a quakec function when an unrecognized key/value pair was found but I could not figure out how to pass in strings to quakec as parameters to the function.
Also, a HUGE problem is the half-life mdl format which is extremely undocumented and you can't use valve's code in the sdk due to licensing issues.

It was really cool to see a hl map running under the quake engine and even having a healthcharger working but without model support this isn't going anywhere.

sfx1999 12-09-2005 22:59

Re: HL1 For other platforms?
 
Are you using the stock QuakeC compiler? I think there is a better one out there.

Lazy 12-09-2005 23:08

Re: HL1 For other platforms?
 
I can't remember which one I used but it was definately a custom one.
That isn't the problem though, inorder to use something like a multi_manager which has upto 16 custom key/value pairs for the target entity and firing delay you need seperate structures/memory for each type of entity.
As far as I know all you get in quakec is the entvars_t structure unlike hl where you got pvPrivateData for classes, ect...

One idea would be to rip out quakec entirely and put a new native system in place but that makes it really tempting to use the HL system.
All the code is there but is unusable to anything but valve products so you'd have to re-create everything including porting over the basic entities from quakec.

But model support is the real killer here, everything else is possible to re-create.

sfx1999 13-09-2005 05:30

Re: HL1 For other platforms?
 
The funny thing is, I was planning to convert Quake to use something similar to HL's system. I guess I'll have to do something else now.

Anyway, to figure it out, I would try to look at the lumps and see what looks like this structure, what looks like that structure, and what is it divisible by. Also, check to see if they are valid as floats or not.

Lazy 19-09-2005 19:23

Re: HL1 For other platforms?
 
Reverse engineering the half-life model format may be too complicated for me :/

Although, I did just reverse engineer the pak file format from q1/q2.
I know its opensource but I wanted to see how difficult it would be to reverse an entire file format.
It was actually pretty easy and oddly enough, fun.

Code:

const int PAK_IDENTITY = ( int ) ( 'K' << 24 ) + ( 'C' << 16 ) + ( 'A' << 8 ) + ( 'P' );

// Structure containing information about files
// stored in pack files.
typedef struct paklump_s {
  char szFilename[ 56 ];        // Filename along with path ( ie. "maps/q2dm1.bsp" )
  int iFileoffset;                  // File offset from start of pak
  int iFilesize;                        // Length of file in bytes
} paklump_t;

// Structure defining the identity of the file aswell
// as the lump offsets/sizes.
typedef struct pakheader_s {
  char packIdentify[ 4 ];        // Non null terminated 4 character string which should contain "PACK"
  int iFirstlump;                        // Offset to the first lump
int iLumpsize;                        // README!!!! THIS IS THE TOTAL SIZE IN BYTES OF THE LUMP TABLE!
                                                        // To get number of lumps divide this by sizeof( paklump_t ).
} pakheader_t;

Not sure about endianness though, I guess I'll have to get xcode installed on the mac and try some things.


All times are GMT +2. The time now is 19:04.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.