Jump to content

the JKA engine Graphical restricions


Recommended Posts

These days i am making the visual efx of my new lightning that replace the force lightning default by classes.

also, i make customize class effect for Mindtrick and Drain, Heal and Rage.

the trouble start with the force lightning and mindtrick: because i have a LARGE amount of new effect to add to the force folder, at least 40 of 50+ new effects >_>

but i found a bad restricion: when i put on the effects\force folder a certain number of new efx file... in game, when i use force power is all okay, but when i use particles effects or blade effects, same weapons hide their efx.

I remenber that, if i make a building of my mod engine with debug system, the system for many of my effect tell me the message "fx system run out of effect" in the console error list. it's signed in white, and is not a critical error. is just a segnalation.

when in game there are a player with all weapons taked with "give all" weapons cheat the player hide of shoot efx and impact of some weapons, so they are not played or displayed.

so i look the code.

and i found something of really interessing.

the code seems to have some BIG restricion, about efx displayed, and also, a restriction about the number max of vertx of the poly of md3 files... and a restriction about the shaders. sometimes you necver get in game, the error "shader max indexes hit?" really frustrating, right? on my  mod i have a model that give me that error if i use in combat for a minutes of serrate fight with sabers.

i think i have founded the core of this problem.

the game is of 2003, so got some bad (and now unuseful) restriction for not overload the driver and video card of the computers of 11 years ago.

but today that'is really frustrating. there is a limitation about max number of efx files that can be sorted on the "effects" folder, there is a limitation of the shader and there is a limitation of the vertx of the mdoels.

how is possible to take down this limit?

i think i have find the solution:

look thats 2 files of the code:

 

Fx_primitives.h

 

 

 

 

 
 
/*
This file is part of Jedi Academy.

    Jedi Academy is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    Jedi Academy is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Jedi Academy.  If not, see <http://www.gnu.org/licenses/>.
*/
// Copyright 2001-2013 Raven Software

#if !defined(FX_SYSTEM_H_INC)
    #include "FxSystem.h"
#endif

#ifndef FX_PRIMITIVES_H_INC
#define FX_PRIMITIVES_H_INC


#define MAX_EFFECTS            1200


// Generic group flags, used by parser, then get converted to the appropriate specific flags
#define FX_PARM_MASK        0xC    // use this to mask off any transition types that use a parm
#define FX_GENERIC_MASK        0xF
#define FX_LINEAR            0x1
#define FX_RAND                0x2
#define FX_NONLINEAR        0x4
#define FX_WAVE                0x8
#define FX_CLAMP            0xC

// Group flags
#define FX_ALPHA_SHIFT        0
#define FX_ALPHA_PARM_MASK    0x0000000C
#define    FX_ALPHA_LINEAR        0x00000001
#define FX_ALPHA_RAND        0x00000002
#define    FX_ALPHA_NONLINEAR    0x00000004
#define FX_ALPHA_WAVE        0x00000008
#define FX_ALPHA_CLAMP        0x0000000C

#define FX_RGB_SHIFT        4
#define FX_RGB_PARM_MASK    0x000000C0
#define    FX_RGB_LINEAR        0x00000010
#define FX_RGB_RAND            0x00000020
#define    FX_RGB_NONLINEAR    0x00000040
#define FX_RGB_WAVE            0x00000080
#define FX_RGB_CLAMP        0x000000C0

#define FX_SIZE_SHIFT        8
#define FX_SIZE_PARM_MASK    0x00000C00
#define    FX_SIZE_LINEAR        0x00000100
#define FX_SIZE_RAND        0x00000200
#define    FX_SIZE_NONLINEAR    0x00000400
#define FX_SIZE_WAVE        0x00000800
#define FX_SIZE_CLAMP        0x00000C00

#define FX_LENGTH_SHIFT        12
#define FX_LENGTH_PARM_MASK    0x0000C000
#define    FX_LENGTH_LINEAR    0x00001000
#define FX_LENGTH_RAND        0x00002000
#define    FX_LENGTH_NONLINEAR    0x00004000
#define FX_LENGTH_WAVE        0x00008000
#define FX_LENGTH_CLAMP        0x0000C000

#define FX_SIZE2_SHIFT        16
#define FX_SIZE2_PARM_MASK    0x000C0000
#define    FX_SIZE2_LINEAR        0x00010000
#define FX_SIZE2_RAND        0x00020000
#define    FX_SIZE2_NONLINEAR    0x00040000
#define FX_SIZE2_WAVE        0x00080000
#define FX_SIZE2_CLAMP        0x000C0000

// Feature flags
#define    FX_DEPTH_HACK        0x00100000
#define    FX_RELATIVE            0x00200000
#define    FX_SET_SHADER_TIME    0x00400000        // by having the effects system set the shader time, we can make animating textures start at the correct time
#define FX_EXPENSIVE_PHYSICS 0x00800000        

//rww - g2-related flags (these can slow things down significantly, use sparingly)
//These should be used only with particles/decals as they steal flags used by cylinders.
#define    FX_GHOUL2_TRACE        0x00020000        //use in conjunction with particles - actually do full ghoul2 traces for physics collision against entities with a ghoul2 instance
                            //shared FX_SIZE2_RAND (used only with cylinders)
#define    FX_GHOUL2_DECALS    0x00040000        //use in conjunction with decals - can project decal as a ghoul2 gore skin object onto ghoul2 models
                            //shared FX_SIZE2_NONLINEAR (used only with cylinders)

#define FX_ATTACHED_MODEL    0x01000000

#define FX_APPLY_PHYSICS    0x02000000
#define FX_USE_BBOX            0x04000000        // can make physics more accurate at the expense of speed

#define FX_USE_ALPHA        0x08000000        // the FX system actually uses RGB to do fades, but this will override that
                                            //    and cause it to fill in the alpha.

#define FX_EMIT_FX            0x10000000        // emitters technically don't have to emit stuff, but when they do
                                            //    this flag needs to be set
#define FX_DEATH_RUNS_FX    0x20000000        // Normal death triggers effect, but not kill_on_impact
#define FX_KILL_ON_IMPACT    0x40000000        // works just like it says, but only when physics are on.
#define FX_IMPACT_RUNS_FX    0x80000000        // an effect can call another effect when it hits something.

// Lightning flags, duplicates of existing flags, but lightning doesn't use those flags in that context...and nothing will ever use these in this context..so we are safe.
#define FX_TAPER            0x01000000        // tapers as it moves towards its endpoint
#define FX_BRANCH            0x02000000        // enables lightning branching
#define FX_GROW                0x04000000        // lightning grows from start point to end point over the course of its life

//------------------------------
class CEffect
{
protected:

    vec3_t        mOrigin1;

    int            mTimeStart;
    int            mTimeEnd;

    unsigned int    mFlags;

    // Size of our object, useful for things that have physics
    vec3_t        mMin;
    vec3_t        mMax;

    int            mImpactFxID;        // if we have an impact event, we may have to call an effect
    int            mDeathFxID;            // if we have a death event, we may have to call an effect

    refEntity_t    mRefEnt;


public:

    CEffect()            { memset( &mRefEnt, 0, sizeof( refEntity_t )); }
    virtual ~CEffect() {}
    virtual void Die() {}

    virtual bool Update()
    {    // Game pausing can cause dumb time things to happen, so kill the effect in this instance
        if ( mTimeStart > theFxHelper.mTime ) {
            return false;
        }    
        return true;
    }

    inline void SetSTScale(float s,float t)    { mRefEnt.shaderTexCoord[0]=s;mRefEnt.shaderTexCoord[1]=t;}

    inline void SetMin( const vec3_t min )        { if(min){VectorCopy(min,mMin);}else{VectorClear(mMin);}            }
    inline void SetMax( const vec3_t max )        { if(max){VectorCopy(max,mMax);}else{VectorClear(mMax);}            }
    inline void SetFlags( int flags )        { mFlags = flags;                }
    inline void AddFlags( int flags )        { mFlags |= flags;                }
    inline void ClearFlags( int flags )        { mFlags &= ~flags;                }
    inline void SetOrigin1( const vec3_t org )    { if(org){VectorCopy(org,mOrigin1);}else{VectorClear(mOrigin1);}    }
    inline void SetTimeStart( int time )    { mTimeStart = time; if (mFlags&FX_SET_SHADER_TIME) { mRefEnt.shaderTime = cg.time * 0.001f; }}
    inline void    SetTimeEnd( int time )        { mTimeEnd = time;                }
    inline void SetImpactFxID( int id )        { mImpactFxID = id;                }
    inline void SetDeathFxID( int id )        { mDeathFxID = id;                }
};


//---------------------------------------------------
// This class is kind of an exception to the "rule".
//    For now it exists only for allowing an easy way
//    to get the saber slash trails rendered.
//---------------------------------------------------
class CTrail : public CEffect
{
// This is such a specific case thing, just grant public access to the goods.
protected:

    void Draw();

public:

    typedef struct
    {
        vec3_t    origin;

        // very specifc case, we can modulate the color and the alpha
        vec3_t    rgb;
        vec3_t    destrgb;
        vec3_t    curRGB;

        float    alpha;
        float    destAlpha;
        float    curAlpha;

        // this is a very specific case thing...allow interpolating the st coords so we can map the texture
        //    properly as this segement progresses through it's life
        float    ST[2];
        float    destST[2];
        float    curST[2];

    } TVert;

    TVert        mVerts[4];
    qhandle_t    mShader;


    CTrail()            {};
    virtual ~CTrail()    {};

    virtual bool Update();
};


//------------------------------
class CLight : public CEffect
{
protected:

    float        mSizeStart;
    float        mSizeEnd;
    float        mSizeParm;

    vec3_t        mRGBStart;
    vec3_t        mRGBEnd;
    float        mRGBParm;


    void        UpdateSize();
    void        UpdateRGB();

    void Draw()
    {
        theFxHelper.AddLightToScene( mOrigin1, mRefEnt.radius,
            mRefEnt.lightingOrigin[0], mRefEnt.lightingOrigin[1], mRefEnt.lightingOrigin[2] );
    }

public:

    CLight() {}
    virtual ~CLight() {}
    virtual bool Update();
    
    inline void SetSizeStart( float sz )    { mSizeStart = sz;            }
    inline void SetSizeEnd( float sz )        { mSizeEnd = sz;            }
    inline void SetSizeParm( float parm )    { mSizeParm = parm;            }

    inline void SetRGBStart( vec3_t rgb )    { if(rgb){VectorCopy(rgb,mRGBStart);}else{VectorClear(mRGBStart);}    }
    inline void SetRGBEnd( vec3_t rgb )        { if(rgb){VectorCopy(rgb,mRGBEnd);}else{VectorClear(mRGBEnd);}        }
    inline void SetRGBParm( float parm )    { mRGBParm = parm;            }
};

//------------------------------
class CFlash : public CLight
{
protected:

    void Draw();

public:

    CFlash() {}
    virtual ~CFlash() {}

    virtual bool Update();

    inline void SetShader( qhandle_t sh )    
    {    assert(sh);
        mRefEnt.customShader = sh;                
    }
    void        Init( void );
};

//------------------------------
class CParticle : public CEffect
{
protected:

    vec3_t        mOrgOffset;

    vec3_t        mVel;
    vec3_t        mAccel;
    float        mGravity;

    float        mSizeStart;
    float        mSizeEnd;
    float        mSizeParm;

    vec3_t        mRGBStart;
    vec3_t        mRGBEnd;
    float        mRGBParm;
    
    float        mAlphaStart;
    float        mAlphaEnd;
    float        mAlphaParm;

    float        mRotationDelta;
    float        mElasticity;

    short        mClientID;
    char        mModelNum;
    char        mBoltNum;

    bool        UpdateOrigin();
    void        UpdateVelocity() {VectorMA( mVel, theFxHelper.mFloatFrameTime, mAccel, mVel ); }

    void        UpdateSize();
    void        UpdateRGB();
    void        UpdateAlpha();
    void        UpdateRotation() { mRefEnt.rotation += theFxHelper.mFrameTime * 0.01f * mRotationDelta; }

    bool Cull();
    void Draw();
    
public:

    inline CParticle() { mRefEnt.reType = RT_SPRITE; mClientID = -1; mModelNum = -1; mBoltNum = -1; }
    virtual ~CParticle() {}

    virtual void Die();
    virtual bool Update();

    inline void SetShader( qhandle_t sh )        { mRefEnt.customShader = sh;}

    inline void SetOrgOffset( const vec3_t o )    { if(o){VectorCopy(o,mOrgOffset);}else{VectorClear(mOrgOffset);}}
    inline void SetVel( const vec3_t vel )        { if(vel){VectorCopy(vel,mVel);}else{VectorClear(mVel);}    }
    inline void SetAccel( const vec3_t ac )        { if(ac){VectorCopy(ac,mAccel);}else{VectorClear(mAccel);}    }
    inline void SetGravity( float grav )        { mGravity = grav;            }

    inline void SetSizeStart( float sz )        { mSizeStart = sz;            }
    inline void SetSizeEnd( float sz )            { mSizeEnd = sz;            }
    inline void SetSizeParm( float parm )        { mSizeParm = parm;            }

    inline void SetRGBStart( const vec3_t rgb )    { if(rgb){VectorCopy(rgb,mRGBStart);}else{VectorClear(mRGBStart);}    }
    inline void SetRGBEnd( const vec3_t rgb )    { if(rgb){VectorCopy(rgb,mRGBEnd);}else{VectorClear(mRGBEnd);}        }
    inline void SetRGBParm( float parm )        { mRGBParm = parm;            }

    inline void SetAlphaStart( float al )        { mAlphaStart = al;            }
    inline void SetAlphaEnd( float al )            { mAlphaEnd = al;            }
    inline void SetAlphaParm( float parm )        { mAlphaParm = parm;        }

    inline void SetRotation( float rot )        { mRefEnt.rotation = rot;    }
    inline void SetRotationDelta( float rot )    { mRotationDelta = rot;        }
    inline void SetElasticity( float el )        { mElasticity = el;            }

    inline void SetClient( int clientID,  int modelNum = -1, int boltNum = -1 )    {mClientID = clientID;    mModelNum = modelNum; mBoltNum = boltNum; }
};


//------------------------------
class CLine : public CParticle
{
protected:

    vec3_t    mOrigin2;

    void Draw();

public:

    CLine() { mRefEnt.reType = RT_LINE;}
    virtual ~CLine() {}
    virtual void Die() {}
    virtual bool Update();


    inline void SetOrigin2( const vec3_t org2 )    { VectorCopy( org2, mOrigin2 ); }
};

//------------------------------
class CBezier : public CLine
{
protected:

    vec3_t    mControl1;
    vec3_t    mControl1Vel;

    vec3_t    mControl2;
    vec3_t    mControl2Vel;

    bool    mInit;

    void Draw();

public:

    CBezier(){ mInit = false; }
    virtual ~CBezier() {}
    virtual void Die() {}

    virtual bool Update();
    
    void DrawSegment( vec3_t start, vec3_t end, float texcoord1, float texcoord2 );

    inline void SetControlPoints( const vec3_t ctrl1, const vec3_t ctrl2 )    { VectorCopy( ctrl1, mControl1 ); VectorCopy( ctrl2, mControl2 ); }
    inline void SetControlVel( const vec3_t ctrl1v, const vec3_t ctrl2v )    { VectorCopy( ctrl1v, mControl1Vel ); VectorCopy( ctrl2v, mControl2Vel ); }
};


//------------------------------
class CElectricity : public CLine
{
protected:

    float    mChaos;

    void Draw();

public:

    CElectricity() { mRefEnt.reType = RT_ELECTRICITY; }
    virtual ~CElectricity() {}
    virtual void Die() {}

    virtual bool Update();

    void Initialize();

    inline void SetChaos( float chaos )        { mChaos = chaos; }
};


// Oriented quad
//------------------------------
class COrientedParticle : public CParticle
{
protected:

    vec3_t    mNormal;
    vec3_t    mNormalOffset;

    bool Cull();
    void Draw();

public:

    COrientedParticle() { mRefEnt.reType = RT_ORIENTED_QUAD; }
    virtual ~COrientedParticle() {}

    virtual bool Update();

    inline void SetNormal( const vec3_t norm )    { VectorCopy( norm, mNormal );    }
    inline void SetNormalOffset( const vec3_t norm )    { VectorCopy( norm, mNormalOffset );    }
};

//------------------------------
class CTail : public CParticle
{
protected:

    vec3_t    mOldOrigin;

    float    mLengthStart;
    float    mLengthEnd;
    float    mLengthParm;

    float    mLength;

    void    UpdateLength();
    void    CalcNewEndpoint();

    void Draw();
    bool Cull();

public:

    CTail() { mRefEnt.reType = RT_LINE; }
    virtual ~CTail() {}

    virtual bool Update();

    inline void SetLengthStart( float len )    { mLengthStart = len;    }
    inline void SetLengthEnd( float len )    { mLengthEnd = len;    }
    inline void SetLengthParm( float len )    { mLengthParm = len;    }
};


//------------------------------
class CCylinder : public CTail
{
protected:

    float        mSize2Start;
    float        mSize2End;
    float        mSize2Parm;

    void    UpdateSize2();

    void Draw();

public:

    CCylinder() { mRefEnt.reType = RT_CYLINDER; }
    virtual ~CCylinder() {}

    virtual bool Update();

    inline void SetSize2Start( float sz )    { mSize2Start = sz;            }
    inline void SetSize2End( float sz )        { mSize2End = sz;            }
    inline void SetSize2Parm( float parm )    { mSize2Parm = parm;        }

    inline void SetNormal( const vec3_t norm )    { VectorCopy( norm, mRefEnt.axis[0] ); }
};


//------------------------------
// Emitters are derived from particles because, although they don't draw, any effect called
//    from them can borrow an initial or ending value from the emitters current alpha, rgb, etc..
class CEmitter : public CParticle
{
protected:

    vec3_t        mOldOrigin;        // we use these to do some nice
    vec3_t        mLastOrigin;    //    tricks...
    vec3_t        mOldVelocity;    //    
    int            mOldTime;

    vec3_t        mAngles;        // for a rotating thing, using a delta  
    vec3_t        mAngleDelta;    //    as opposed to an end angle is probably much easier

    int            mEmitterFxID;    // if we have emitter fx, this is our id

    float        mDensity;        // controls how often emitter chucks an effect
    float        mVariance;        // density sloppiness

    void        UpdateAngles();

    void Draw();

public:

    CEmitter() {
        // There may or may not be a model, but if there isn't one,
        //    we just won't bother adding the refEnt in our Draw func
        mRefEnt.reType = RT_MODEL;
    }
    virtual ~CEmitter() {}

    virtual bool Update();

    inline void SetModel( qhandle_t model )        { mRefEnt.hModel = model;    }
    inline void SetAngles( const vec3_t ang )    { if(ang){VectorCopy(ang,mAngles);}else{VectorClear(mAngles);}            }
    inline void SetAngleDelta( const vec3_t ang){ if(ang){VectorCopy(ang,mAngleDelta);}else{VectorClear(mAngleDelta);}    }
    inline void SetEmitterFxID( int id )        { mEmitterFxID = id;        }
    inline void SetDensity( float density )        { mDensity = density;        }
    inline void SetVariance( float var )        { mVariance = var;            }
    inline void SetOldTime( int time )            { mOldTime = time;            }
    inline void SetLastOrg( const vec3_t org )    { if(org){VectorCopy(org,mLastOrigin);}else{VectorClear(mLastOrigin);}    }
    inline void SetLastVel( const vec3_t vel )    { if(vel){VectorCopy(vel,mOldVelocity);}else{VectorClear(mOldVelocity);}}

};

// We're getting pretty low level here, not the kind of thing to abuse considering how much overhead this
//    adds to a SINGLE triangle or quad....
// The editor doesn't need to see or do anything with this
//------------------------------
#define MAX_CPOLY_VERTS    5

class CPoly : public CParticle
{
protected:

    int        mCount;
    vec3_t    mRotDelta;
    int        mTimeStamp;

    bool Cull();
    void Draw();

public:

    vec3_t    mOrg[MAX_CPOLY_VERTS];
    vec2_t    mST[MAX_CPOLY_VERTS];

    float    mRot[3][3];
    int        mLastFrameTime;


    CPoly()                {}
    virtual ~CPoly()    {}

    virtual bool Update();

    void PolyInit();
    void CalcRotateMatrix();
    void Rotate();

    inline void SetNumVerts( int c )                    { mCount = c;            }
    inline void SetRot( vec3_t r )                        { if(r){VectorCopy(r,mRotDelta);}else{VectorClear(mRotDelta);}}
    inline void SetMotionTimeStamp( int t )                { mTimeStamp = theFxHelper.mTime + t; }
    inline int    GetMotionTimeStamp()                    { return mTimeStamp; }
};


#endif //FX_PRIMITIVES_H_INC

 

 

if i change that:

"#define MAX_EFFECTS            1200"

value with a mooore large value, maybe i can solve my problem.

 

about the vertexes and shader limitation, these restriction can be outtaked here:

 

qfiles.h

 

 

 

 
/*
This file is part of Jedi Academy.

    Jedi Academy is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    Jedi Academy is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Jedi Academy.  If not, see <http://www.gnu.org/licenses/>.
*/
// Copyright 2001-2013 Raven Software

#ifndef __QFILES_H__
#define __QFILES_H__

//
// qfiles.h: quake file formats
// This file must be identical in the quake and utils directories
//

// surface geometry should not exceed these limits
#define    SHADER_MAX_VERTEXES    1000
#define    SHADER_MAX_INDEXES    (6*SHADER_MAX_VERTEXES)


// the maximum size of game reletive pathnames
#define    MAX_QPATH        64

/*
========================================================================

QVM files

========================================================================
*/

#define    VM_MAGIC    0x12721444
typedef struct {
    int        vmMagic;

    int        instructionCount;

    int        codeOffset;
    int        codeLength;

    int        dataOffset;
    int        dataLength;
    int        litLength;            // ( dataLength - litLength ) should be byteswapped on load
    int        bssLength;            // zero filled memory appended to datalength
} vmHeader_t;

/*
========================================================================

PCX files are used for 8 bit images

========================================================================
*/

typedef struct {
    char    manufacturer;
    char    version;
    char    encoding;
    char    bits_per_pixel;
    unsigned short    xmin,ymin,xmax,ymax;
    unsigned short    hres,vres;
    unsigned char    palette[48];
    char    reserved;
    char    color_planes;
    unsigned short    bytes_per_line;
    unsigned short    palette_type;
    char    filler[58];
    unsigned char    data;            // unbounded
} pcx_t;


/*
========================================================================

TGA files are used for 24/32 bit images

========================================================================
*/

typedef struct _TargaHeader {
    unsigned char     id_length, colormap_type, image_type;
    unsigned short    colormap_index, colormap_length;
    unsigned char    colormap_size;
    unsigned short    x_origin, y_origin, width, height;
    unsigned char    pixel_size, attributes;
} TargaHeader;



/*
========================================================================

.MD3 triangle model file format

========================================================================
*/

#define MD3_IDENT            (('3'<<24)+('P'<<16)+('D'<<8)+'I')
#define MD3_VERSION            15

// limits
#define MD3_MAX_LODS        3
#define    MD3_MAX_TRIANGLES    8192    // per surface
#define MD3_MAX_VERTS        4096    // per surface
#define MD3_MAX_SHADERS        256        // per surface
#define MD3_MAX_FRAMES        1024    // per model
#define    MD3_MAX_SURFACES    32 + 32    // per model
#define MD3_MAX_TAGS        16        // per frame

// vertex scales
#define    MD3_XYZ_SCALE        (1.0/64)

typedef struct md3Frame_s {
    vec3_t        bounds[2];
    vec3_t        localOrigin;
    float        radius;
    char        name[16];
} md3Frame_t;

typedef struct md3Tag_s {
    char        name[MAX_QPATH];    // tag name
    vec3_t        origin;
    vec3_t        axis[3];
} md3Tag_t;

/*
** md3Surface_t
**
** CHUNK            SIZE
** header            sizeof( md3Surface_t )
** shaders            sizeof( md3Shader_t ) * numShaders
** triangles[0]        sizeof( md3Triangle_t ) * numTriangles
** st                sizeof( md3St_t ) * numVerts
** XyzNormals        sizeof( md3XyzNormal_t ) * numVerts * numFrames
*/
typedef struct {
    int        ident;                //

    char    name[MAX_QPATH];    // polyset name

    int        flags;
    int        numFrames;            // all surfaces in a model should have the same

    int        numShaders;            // all surfaces in a model should have the same
    int        numVerts;

    int        numTriangles;
    int        ofsTriangles;

    int        ofsShaders;            // offset from start of md3Surface_t
    int        ofsSt;                // texture coords are common for all frames
    int        ofsXyzNormals;        // numVerts * numFrames

    int        ofsEnd;                // next surface follows
} md3Surface_t;

typedef struct {
    char            name[MAX_QPATH];
    int                shaderIndex;    // for in-game use
} md3Shader_t;

typedef struct {
    int            indexes[3];
} md3Triangle_t;

typedef struct {
    float        st[2];
} md3St_t;

typedef struct {
    short        xyz[3];
    short        normal;
} md3XyzNormal_t;

typedef struct {
    int            ident;
    int            version;

    char        name[MAX_QPATH];    // model name

    int            flags;

    int            numFrames;
    int            numTags;            
    int            numSurfaces;

    int            numSkins;

    int            ofsFrames;            // offset for first frame
    int            ofsTags;            // numFrames * numTags
    int            ofsSurfaces;        // first surface, others follow

    int            ofsEnd;                // end of file
} md3Header_t;


/*
==============================================================================

  .BSP file format

==============================================================================
*/


#define BSP_IDENT    (('P'<<24)+('S'<<16)+('B'<<8)+'R')
        // little-endian "IBSP"

#define BSP_VERSION            1


// there shouldn't be any problem with increasing these values at the
// expense of more memory allocation in the utilities
#define    MAX_MAP_MODELS        0x400
#define    MAX_MAP_BRUSHES        0x8000
#define    MAX_MAP_ENTITIES    0x800
#define    MAX_MAP_ENTSTRING    0x40000
#define    MAX_MAP_SHADERS        0x400

#define    MAX_MAP_AREAS        0x100    // MAX_MAP_AREA_BYTES in q_shared must match!
#define    MAX_MAP_FOGS        0x100
#define    MAX_MAP_PLANES        0x20000
#define    MAX_MAP_NODES        0x20000
#define    MAX_MAP_BRUSHSIDES    0x20000
#define    MAX_MAP_LEAFS        0x20000
#define    MAX_MAP_LEAFFACES    0x20000
#define    MAX_MAP_LEAFBRUSHES 0x40000
#define    MAX_MAP_PORTALS        0x20000
#define    MAX_MAP_LIGHTING    0x800000
#define    MAX_MAP_LIGHTGRID    65535
#define    MAX_MAP_LIGHTGRID_ARRAY    0x100000

#define    MAX_MAP_VISIBILITY    0x400000

#define    MAX_MAP_DRAW_SURFS    0x20000
#define    MAX_MAP_DRAW_VERTS    0x80000
#define    MAX_MAP_DRAW_INDEXES    0x80000


// key / value pair sizes in the entities lump
#define    MAX_KEY                32
#define    MAX_VALUE            1024

// the editor uses these predefined yaw angles to orient entities up or down
#define    ANGLE_UP            -1
#define    ANGLE_DOWN            -2

#define    LIGHTMAP_WIDTH        128
#define    LIGHTMAP_HEIGHT        128

//=============================================================================

typedef struct {
    int        fileofs, filelen;
} lump_t;

#define    LUMP_ENTITIES        0
#define    LUMP_SHADERS        1
#define    LUMP_PLANES            2
#define    LUMP_NODES            3
#define    LUMP_LEAFS            4
#define    LUMP_LEAFSURFACES    5
#define    LUMP_LEAFBRUSHES    6
#define    LUMP_MODELS            7
#define    LUMP_BRUSHES        8
#define    LUMP_BRUSHSIDES        9
#define    LUMP_DRAWVERTS        10
#define    LUMP_DRAWINDEXES    11
#define    LUMP_FOGS            12
#define    LUMP_SURFACES        13
#define    LUMP_LIGHTMAPS        14
#define    LUMP_LIGHTGRID        15
#define    LUMP_VISIBILITY        16
#define LUMP_LIGHTARRAY        17
#define    HEADER_LUMPS        18

typedef struct {
    int            ident;
    int            version;

    lump_t        lumps[HEADER_LUMPS];
} dheader_t;

typedef struct {
    float        mins[3], maxs[3];
    int            firstSurface, numSurfaces;
    int            firstBrush, numBrushes;
} dmodel_t;

typedef struct dshader_s {
    char        shader[MAX_QPATH];
    int            surfaceFlags;
    int            contentFlags;
} dshader_t;

// planes x^1 is allways the opposite of plane x

typedef struct {
    float        normal[3];
    float        dist;
} dplane_t;

typedef struct {
    int            planeNum;
    int            children[2];    // negative numbers are -(leafs+1), not nodes
    int            mins[3];        // for frustom culling
    int            maxs[3];
} dnode_t;

typedef struct {
    int            cluster;            // -1 = opaque cluster (do I still store these?)
    int            area;

    int            mins[3];            // for frustum culling
    int            maxs[3];

    int            firstLeafSurface;
    int            numLeafSurfaces;

    int            firstLeafBrush;
    int            numLeafBrushes;
} dleaf_t;

typedef struct {
    int            planeNum;            // positive plane side faces out of the leaf
    int            shaderNum;
    int            drawSurfNum;
} dbrushside_t;

typedef struct {
    int            firstSide;
    int            numSides;
    int            shaderNum;        // the shader that determines the contents flags
} dbrush_t;

typedef struct {
    char        shader[MAX_QPATH];
    int            brushNum;
    int            visibleSide;    // the brush side that ray tests need to clip against (-1 == none)
} dfog_t;

// Light Style Constants
#define    MAXLIGHTMAPS    4
#define LS_NORMAL        0x00
#define LS_UNUSED        0xfe
#define    LS_NONE            0xff
#define MAX_LIGHT_STYLES        64

typedef struct {
    vec3_t        xyz;
    float        st[2];
    float        lightmap[MAXLIGHTMAPS][2];
    vec3_t        normal;
    byte        color[MAXLIGHTMAPS][4];
} mapVert_t;

typedef struct {
    vec3_t        xyz;
    float        st[2];
    float        lightmap[MAXLIGHTMAPS][2];
    vec3_t        normal;
    byte        color[MAXLIGHTMAPS][4];
} drawVert_t;

typedef struct
{
    byte        ambientLight[MAXLIGHTMAPS][3];
    byte        directLight[MAXLIGHTMAPS][3];
    byte        styles[MAXLIGHTMAPS];
    byte        latLong[2];
}  dgrid_t;

typedef enum {
    MST_BAD,
    MST_PLANAR,
    MST_PATCH,
    MST_TRIANGLE_SOUP,
    MST_FLARE
} mapSurfaceType_t;

typedef struct {
    int            shaderNum;
    int            fogNum;
    int            surfaceType;

    int            firstVert;
    int            numVerts;

    int            firstIndex;
    int            numIndexes;

    byte        lightmapStyles[MAXLIGHTMAPS], vertexStyles[MAXLIGHTMAPS];
    int            lightmapNum[MAXLIGHTMAPS];
    int            lightmapX[MAXLIGHTMAPS], lightmapY[MAXLIGHTMAPS];
    int            lightmapWidth, lightmapHeight;

    vec3_t        lightmapOrigin;
    vec3_t        lightmapVecs[3];    // for patches, [0] and [1] are lodbounds

    int            patchWidth;
    int            patchHeight;
} dsurface_t;

typedef enum //# hunkAllocType_e
{
    HA_MISC,    
    HA_MAP,
    HA_SHADERS,
    HA_LIGHTING,
    HA_FOG,
    HA_PATCHES,
    HA_VIS,
    HA_SUBMODELS,
    HA_MODELS,
    MAX_HA_TYPES
} hunkAllocType_t;



/////////////////////////////////////////////////////////////
//
// Defines and structures required for fonts

#define GLYPH_COUNT            256

// Must match define in stmparse.h
#define STYLE_DROPSHADOW    0x80000000
#define STYLE_BLINK            0x40000000
#define    SET_MASK            0x00ffffff

typedef struct
{
    short        width;                    // number of pixels wide
    short        height;                    // number of scan lines
    short        horizAdvance;            // number of pixels to advance to the next char
    short        horizOffset;            // x offset into space to render glyph
    int            baseline;                // y offset
    float        s;                        // x start tex coord
    float        t;                        // y start tex coord
    float        s2;                        // x end tex coord
    float        t2;                        // y end tex coord
} glyphInfo_t;


// this file corresponds 1:1 with the "*.fontdat" files, so don't change it unless you're going to
//    recompile the fontgen util and regenerate all the fonts!
//
typedef struct dfontdat_s
{
    glyphInfo_t        mGlyphs[GLYPH_COUNT];

    short            mPointSize;
    short            mHeight;                // max height of font
    short            mAscender;
    short            mDescender;

    short            mKoreanHack;            // unused field, written out by John's fontgen program but we have to leave it there for disk structs <sigh>
} dfontdat_t;

/////////////////// fonts end ////////////////////////////////////



#endif
 

 

 

 

so my theory is: here you can edit and bypass the engine limitation about md3 model vertx, shadering, bsp map etc :)

 

 

 

 

Link to comment

I got right! On fxscheduler i found that:

 

 

 

void CFxScheduler::Clean(bool bRemoveTemplates /*= true*/, int idToPreserve /*= 0*/)
{
int i, j;
TScheduledEffect::iterator itr, next;

// Ditch any scheduled effects
itr = mFxSchedule.begin();

while ( itr != mFxSchedule.end() )
{
next = itr;
next++;

delete *itr;
mFxSchedule.erase(itr);

itr = next;
}

if (bRemoveTemplates)
{
// Ditch any effect templates
for ( i = 1; i < FX_MAX_EFFECTS; i++ )
{
if ( i == idToPreserve)
{
continue;
}

if ( mEffectTemplates[i].mInUse )
{
// Ditch the primitives
for (j = 0; j < mEffectTemplates[i].mPrimitiveCount; j++)
{
delete mEffectTemplates[i].mPrimitives[j];
}
}

mEffectTemplates[i].mInUse = false;
}

if (idToPreserve == 0)
{
mEffectIDs.clear();
}
else
{
// Clear the effect names, but first get the name of the effect to preserve,
// and restore it after clearing.
fxString_t str;
TEffectID::iterator iter;

for (iter = mEffectIDs.begin(); iter != mEffectIDs.end(); ++iter)
{
if ((*iter).second == idToPreserve)
{
str = (*iter).first;
break;
}
}

mEffectIDs.clear();

mEffectIDs[str] = idToPreserve;
}
}
}

That's string hide and delete the primitives precached hiding the visual effects, if their number is superior of the MAX_INDEXES_EFFECTS Parameter! :)

Link to comment

I was right about the shader max indexes error,

i edited 6* to the error with the parameter

 

 SHADER_MAX_INDEXES    (6*SHADER_MAX_VERTEXES)

 

to

 

 SHADER_MAX_INDEXES    (12*SHADER_MAX_VERTEXES)

model stilll crash but in the advance part of the fight, not immediatly. so is really a buffer engine problem. i wil try with another highter value.

for the efx problem, i not found the solution, the problem persist. :\ Mayve i was wrong on my intuition. if someone can help me with the effects restricion every help is accepted. :)

Link to comment

@@ensiform ah, okay, so MAX_EFFECTS indicate the max fx_runner number that contain a gtk radiant. understood. regard the other field, i can edit the max number or vertexes with greate peace of two  my .md3 HD models. O.o for the GLM mesh i thin is not possibile 

regard the max_shader_indexes depend by the max verts value, so change the one change also the second, understood.

Sorry, but JAcoders site is be deleted, so i cannot enter more into your chat chan. O.O. because i have ever entered by the link of the Jacoders main page site. :(

However, how can i solve the hiding of the efx shooting by the weapons? i need to search the function of fx_system that hide the overbuffed effects. >_> Otherwise... i need to  descard by the code of some of my new mindtrick efx, pity :\ 

Link to comment

You could always install a real IRC Client or use other web chat links that are on the OJK readme etc.

 

As for the effects related stuff, I don't know which defines are actually for increasing the number of visible effects etc. ent increased a lot of that stuff in jamme.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...