Just wondering if anyone has implemented AVIkit and is willing to part with
the code :) or if AVIkit has been used in any open source mods (rebirth and
arrangemod have the lib's included but don't actually call the functions).
I'd do it myself but it would literally take years (I'm a moron), it'd be
easier just to ask for it here just incase any devs have a dead hl1 mod with
the code already laid out :)

I've scoured the internet and all I could find was this on a russian HL
coding site which seems to use the code but I'm not sure if it's an entire
replacement for avikit.cpp or if it fits in there somehow (again I'm a moron
when it comes to this)



 ///////////////////////////////////////////////////////////////
// Only setup the avi if it's actually a video screen

if (isVideoScreen && replacement[0] != '\0') {
    char *error_msg = NULL;
    long xres = 0;
    long yres = 0;
    float duration = 0.0f;

    movie = new AVIKit( absolute_replacement, false );
    if (movie->getError( &error_msg ) != AVIKIT_NOERROR) {
        gEngfuncs.Con_DPrintf( "SetupAvisFromEntities: Error opening %s:
%s\n", absolute_replacement, error_msg );
        delete movie;
        break;
    }
    movie->getVideoInfo( &xres, &yres, &duration );
    gEngfuncs.Con_DPrintf( "SetupAvisFromEntities: Opened %s: %ld x %ld (%f
secs)\n", replacement, xres, yres, duration );
    gEngfuncs.Con_DPrintf( "Video screen at (%d %d %d), with extents (%d %d
%d)\n",
    (int)origin[0], (int)origin[1], (int)origin[2],
    (int)extents[0], (int)extents[1], (int)extents[2] );

    // Create the OpenGL texture
    GLuint texnum;
    glGenTextures( 1, &texnum );

    if (!AddComplexAvi( movie, texnum, origin, angles, extents, &error_msg
)) {
        gEngfuncs.Con_DPrintf( "SetupAvisFromEntities: Error adding movie:
%s\n", error_msg );
        delete movie;
    }
    } else if (isVideoScreen) {
        gEngfuncs.Con_DPrintf( "SetupAvisFromEntities: Video screen didn't
have a movie specified!\n" );
    }

    //Setting up the texture:

    movie->getVideoInfo( &data->width, &data->height, &data->total_length );
    glEnable( GL_TEXTURE_2D );
    glBindTexture( GL_TEXTURE_2D, data->texture_index );
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D( GL_TEXTURE_2D, 0, 3, data->width, data->height, 0, GL_RGB,
GL_UNSIGNED_BYTE, tmpbuffer );

    //Updating the texture each frame:

    // Calculate the frame needed
    int frame = i->movie->getVideoFrameNumber( i->current_time );

    // If the frame has changed, re-upload it
    if (frame != i->current_frame) {
        i->current_frame = frame;
        i->movie->getVideoFrame( (char*)i->buffer, frame );

        // If the video isn't a power of two on all sides, we need to resize
it... <img src="images/smilies/frown.gif" border="0" alt="">
        if (i->resized_buffer) {
            gluScaleImage( GL_RGB, i->realwidth, i->realheight,
GL_UNSIGNED_BYTE, i->buffer, i->width, i->height, GL_UNSIGNED_BYTE,
i->resized_buffer );
            // ... and update the OpenGL texture ...
            glEnable(GL_TEXTURE_2D);
            glBindTexture( GL_TEXTURE_2D, i->texture_index );
            glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, i->width, i->height,
GL_RGB, GL_UNSIGNED_BYTE, i->resized_buffer );
            } else {
                // ... and update the OpenGL texture ...
                glEnable(GL_TEXTURE_2D);
                glBindTexture( GL_TEXTURE_2D, i->texture_index );
                glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, i->width,
i->height, GL_RGB, GL_UNSIGNED_BYTE, i->buffer );
            }
        }

        // If this is a complex movie, draw the polygons
        if (i->texture_type == AVI_TEXTURE_USER) {

            glEnable( GL_TEXTURE_2D );
            glBindTexture( GL_TEXTURE_2D, i->texture_index );
            glDisable( GL_BLEND );
            glBegin( GL_QUADS );

            // Top left
            glColor3f( 1.0f, 1.0f, 1.0f );
            glTexCoord2f( 0.0f, 1.0f );
            glVertex3f( i->vertexes[0].x, i->vertexes[0].y, i->vertexes[0].z
);

            // Bottom left
            glColor3f( 1.0f, 1.0f, 1.0f );
            glTexCoord2f( 0.0f, 0.0f );
            glVertex3f( i->vertexes[1].x, i->vertexes[1].y, i->vertexes[1].z
);

            // Bottom right
            glColor3f( 1.0f, 1.0f, 1.0f );
            glTexCoord2f( 1.0f, 0.0f );
            glVertex3f( i->vertexes[2].x, i->vertexes[2].y, i->vertexes[2].z
);

            // Top right
            glColor3f( 1.0f, 1.0f, 1.0f );
            glTexCoord2f( 1.0f, 1.0f );
            glVertex3f( i->vertexes[3].x, i->vertexes[3].y, i->vertexes[3].z
);

            glEnd();
        }
 ///////////////////////////////////////////////////////////////


Regardless of this, the AVIkit mod also included fmod.dll, which I'm
guessing is used for sound and I'm not sure how it pulls this from the AVI.

Kevin
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to