Forum

looking for an old fix i made for mhquake 6

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

looking for an old fix i made for mhquake 6

Postby revelator » Mon Nov 22, 2010 4:40 pm

was posted on the old quakesrc forums.

was a small fix i made because the texture loader didnt scale the textures correctly, unfortunatly its been so long i forgot what i did :oops:

i ported the old code to mingw + codeblocks and it works fine besides the above.

might ask why im interrested in such an old engine well for one its blazing fast, and quite advanced for its time. also has some educationary properties since it implements a lot of the stuff discussed here lately like halflife map support colored lightning etc.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby revelator » Sun Nov 28, 2010 9:00 am

ok ditch it i found the culprit ;)

Code: Select all
int CheckTexImage (char *ext, char *new_ident, char *loadname, int *width, int *height, qboolean mipmap, qboolean alpha, int (*LoadFunc) (), qboolean fake_pcx_alpha)
{
   int i, j;
   char full_path[1024];
   int return_rgba;
   int old_width, old_height;

   old_width = *width;
   old_height = *height;

   sprintf (full_path, "textures/%s.%s", new_ident, ext);
   i = COM_FOpenFile (full_path, &file32bit);

   if (file32bit)
   {
      // using pointers here will give us the correct width and height of the external texture
      j = (*LoadFunc) (width, height, false, fake_pcx_alpha);

      if (j)
      {
         // we can't return straight away because we need to clean up after ourselves first
         if (!gl_texscale.value)
         {
            return_rgba = MHGL_LoadTexture (loadname, old_width, old_height, image_rgba, mipmap, alpha, 32);
         }
         else
         {
                return_rgba = MHGL_LoadTexture (loadname, *width, *height, image_rgba, mipmap, alpha, 32);
         }

            // even if we have an invalid image, the file is still open (although image_rgba won't
            // have been malloced yet) so we need to close it.
            free (image_rgba);
            fclose (file32bit);

            // because some of the loading functions can create an error after modifying height
            // and width, we must reset them for the actual load of the internal texture.
            *width = old_width;
            *height = old_height;
      }

      // oups we returned the value before resetting
      // the size :( making textures scale wrong. moved here.
        return return_rgba;
    }
   return -1;
}
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby revelator » Tue Nov 30, 2010 10:37 pm

and for the nostalgic (or if you prefer future reference i commented the big nono's)

source for codeblocks ftp://90.184.233.166:21/mhglqr6-cb-src.7z

executable ftp://90.184.233.166:21/mhglqr6-mingw.7z

i fixed a few things like the textureloader but underwater fog still needs looking at (same bug i had in realm also in this heh).

added infinite bbox and underwater warp code from mh.

engine has waterwaves the default value went as high as 20 which caused them to warp so violently that they went above most surfs. i clamped it to 3 which looks decent but the menu option needs looking at. the increment for the slider was 1.5 i believe so it doesnt work right now.

engine supports vertex and colored lighting and has lit and fullbright support by default.

it also has mirrors.

and then it has script support.

known bugs psychadelic player (need to rework the code for drawing the player ugh).

underwater fog has leaf check issues causing it to turn off or draw wrong at some angles (same one i had in realm will fix it soon).

ill see if i can get the above fixed if theres interrest in keeping the source for codebits or just plain nostalgia.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest