Annotation of quake2/client/ref.h, revision 1.1.1.2

1.1       root        1: 
                      2: #include "../qcommon/qcommon.h"
1.1.1.2 ! root        3: 
1.1       root        4: #define        MAX_DLIGHTS             32
                      5: #define        MAX_ENTITIES    128
                      6: #define        MAX_PARTICLES   4096
                      7: #define        MAX_LIGHTSTYLES 256
1.1.1.2 ! root        8: 
1.1       root        9: #define POWERSUIT_SCALE                4.0F
1.1.1.2 ! root       10: 
1.1       root       11: #define SHELL_RED_COLOR                0xF2
                     12: #define SHELL_GREEN_COLOR      0xD0
                     13: #define SHELL_BLUE_COLOR       0xF3
1.1.1.2 ! root       14: 
1.1       root       15: #define SHELL_RG_COLOR         0xDC
                     16: #define SHELL_RB_COLOR         0x86
                     17: #define SHELL_BG_COLOR         0x78
1.1.1.2 ! root       18: 
1.1       root       19: #define SHELL_WHITE_COLOR      0xD7
1.1.1.2 ! root       20: 
1.1       root       21: typedef struct entity_s
                     22: {
                     23:        struct model_s          *model;                 // opaque type outside refresh
                     24:        float                           angles[3];
1.1.1.2 ! root       25: 
1.1       root       26:        /*
                     27:        ** most recent data
                     28:        */
                     29:        float                           origin[3];              // also used as RF_BEAM's "from"
                     30:        int                                     frame;                  // also used as RF_BEAM's diameter
1.1.1.2 ! root       31: 
1.1       root       32:        /*
                     33:        ** previous data for lerping
                     34:        */
                     35:        float                           oldorigin[3];   // also used as RF_BEAM's "to"
                     36:        int                                     oldframe;
1.1.1.2 ! root       37: 
1.1       root       38:        /*
                     39:        ** misc
                     40:        */
                     41:        float   backlerp;                               // 0.0 = current, 1.0 = old
                     42:        int             skinnum;                                // also used as RF_BEAM's palette index
1.1.1.2 ! root       43: 
1.1       root       44:        int             lightstyle;                             // for flashing entities
                     45:        float   alpha;                                  // ignore if RF_TRANSLUCENT isn't set
1.1.1.2 ! root       46: 
1.1       root       47:        struct image_s  *skin;                  // NULL for inline skin
                     48:        int             flags;
1.1.1.2 ! root       49: 
1.1       root       50: } entity_t;
1.1.1.2 ! root       51: 
1.1       root       52: #define ENTITY_FLAGS  68
1.1.1.2 ! root       53: 
1.1       root       54: typedef struct
                     55: {
                     56:        vec3_t  origin;
                     57:        vec3_t  color;
                     58:        float   intensity;
                     59: } dlight_t;
1.1.1.2 ! root       60: 
1.1       root       61: typedef struct
                     62: {
                     63:        vec3_t  origin;
                     64:        int             color;
                     65:        float   alpha;
                     66: } particle_t;
1.1.1.2 ! root       67: 
1.1       root       68: typedef struct
                     69: {
                     70:        float           rgb[3];                 // 0.0 - 2.0
                     71:        float           white;                  // highest of rgb
                     72: } lightstyle_t;
1.1.1.2 ! root       73: 
1.1       root       74: typedef struct
                     75: {
                     76:        int                     x, y, width, height;// in virtual screen coordinates
                     77:        float           fov_x, fov_y;
                     78:        float           vieworg[3];
                     79:        float           viewangles[3];
                     80:        float           blend[4];                       // rgba 0-1 full screen blend
                     81:        float           time;                           // time is uesed to auto animate
                     82:        int                     rdflags;                        // RDF_UNDERWATER, etc
1.1.1.2 ! root       83: 
1.1       root       84:        byte            *areabits;                      // if not NULL, only areas with set bits will be drawn
1.1.1.2 ! root       85: 
1.1       root       86:        lightstyle_t    *lightstyles;   // [MAX_LIGHTSTYLES]
1.1.1.2 ! root       87: 
1.1       root       88:        int                     num_entities;
                     89:        entity_t        *entities;
1.1.1.2 ! root       90: 
1.1       root       91:        int                     num_dlights;
                     92:        dlight_t        *dlights;
1.1.1.2 ! root       93: 
1.1       root       94:        int                     num_particles;
                     95:        particle_t      *particles;
                     96: } refdef_t;
1.1.1.2 ! root       97: 
        !            98: 
        !            99: 
1.1       root      100: #define        API_VERSION             3
1.1.1.2 ! root      101: 
1.1       root      102: //
                    103: // these are the functions exported by the refresh module
                    104: //
                    105: typedef struct
                    106: {
                    107:        // if api_version is different, the dll cannot be used
                    108:        int             api_version;
1.1.1.2 ! root      109: 
1.1       root      110:        // called when the library is loaded
                    111:        qboolean        (*Init) ( void *hinstance, void *wndproc );
1.1.1.2 ! root      112: 
1.1       root      113:        // called before the library is unloaded
                    114:        void    (*Shutdown) (void);
1.1.1.2 ! root      115: 
1.1       root      116:        // All data that will be used in a level should be
                    117:        // registered before rendering any frames to prevent disk hits,
                    118:        // but they can still be registered at a later time
                    119:        // if necessary.
                    120:        //
                    121:        // EndRegistration will free any remaining data that wasn't registered.
                    122:        // Any model_s or skin_s pointers from before the BeginRegistration
                    123:        // are no longer valid after EndRegistration.
                    124:        //
                    125:        // Skins and images need to be differentiated, because skins
                    126:        // are flood filled to eliminate mip map edge errors, and pics have
                    127:        // an implicit "pics/" prepended to the name. (a pic name that starts with a
                    128:        // slash will not use the "pics/" prefix or the ".pcx" postfix)
                    129:        void    (*BeginRegistration) (char *map);
                    130:        struct model_s *(*RegisterModel) (char *name);
                    131:        struct image_s *(*RegisterSkin) (char *name);
                    132:        struct image_s *(*RegisterPic) (char *name);
                    133:        void    (*SetSky) (char *name, float rotate, vec3_t axis);
                    134:        void    (*EndRegistration) (void);
1.1.1.2 ! root      135: 
1.1       root      136:        void    (*RenderFrame) (refdef_t *fd);
1.1.1.2 ! root      137: 
1.1       root      138:        void    (*DrawGetPicSize) (int *w, int *h, char *name); // will return 0 0 if not found
                    139:        void    (*DrawPic) (int x, int y, char *name);
                    140:        void    (*DrawStretchPic) (int x, int y, int w, int h, char *name);
                    141:        void    (*DrawChar) (int x, int y, int c);
                    142:        void    (*DrawTileClear) (int x, int y, int w, int h, char *name);
                    143:        void    (*DrawFill) (int x, int y, int w, int h, int c);
                    144:        void    (*DrawFadeScreen) (void);
1.1.1.2 ! root      145: 
1.1       root      146:        // Draw images for cinematic rendering (which can have a different palette). Note that calls
                    147:        void    (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, byte *data);
1.1.1.2 ! root      148: 
1.1       root      149:        /*
                    150:        ** video mode and refresh state management entry points
                    151:        */
                    152:        void    (*CinematicSetPalette)( const unsigned char *palette);  // NULL = game palette
                    153:        void    (*BeginFrame)( float camera_separation );
                    154:        void    (*EndFrame) (void);
1.1.1.2 ! root      155: 
1.1       root      156:        void    (*AppActivate)( qboolean activate );
1.1.1.2 ! root      157: 
1.1       root      158: } refexport_t;
1.1.1.2 ! root      159: 
1.1       root      160: //
                    161: // these are the functions imported by the refresh module
                    162: //
                    163: typedef struct
                    164: {
                    165:        void    (*Sys_Error) (int err_level, char *str, ...);
1.1.1.2 ! root      166: 
1.1       root      167:        void    (*Cmd_AddCommand) (char *name, void(*cmd)(void));
                    168:        void    (*Cmd_RemoveCommand) (char *name);
                    169:        int             (*Cmd_Argc) (void);
                    170:        char    *(*Cmd_Argv) (int i);
                    171:        void    (*Cmd_ExecuteText) (int exec_when, char *text);
1.1.1.2 ! root      172: 
1.1       root      173:        void    (*Con_Printf) (int print_level, char *str, ...);
1.1.1.2 ! root      174: 
1.1       root      175:        // files will be memory mapped read only
                    176:        // the returned buffer may be part of a larger pak file,
                    177:        // or a discrete file from anywhere in the quake search path
                    178:        // a -1 return means the file does not exist
                    179:        // NULL can be passed for buf to just determine existance
                    180:        int             (*FS_LoadFile) (char *name, void **buf);
                    181:        void    (*FS_FreeFile) (void *buf);
1.1.1.2 ! root      182: 
1.1       root      183:        // gamedir will be the current directory that generated
                    184:        // files should be stored to, ie: "f:\quake\id1"
                    185:        char    *(*FS_Gamedir) (void);
1.1.1.2 ! root      186: 
1.1       root      187:        cvar_t  *(*Cvar_Get) (char *name, char *value, int flags);
                    188:        cvar_t  *(*Cvar_Set)( char *name, char *value );
                    189:        void     (*Cvar_SetValue)( char *name, float value );
1.1.1.2 ! root      190: 
1.1       root      191:        qboolean        (*Vid_GetModeInfo)( int *width, int *height, int mode );
                    192:        void            (*Vid_MenuInit)( void );
                    193:        void            (*Vid_NewWindow)( int width, int height );
                    194: } refimport_t;
1.1.1.2 ! root      195: 
        !           196: 
1.1       root      197: // this is the only function actually exported at the linker level
                    198: typedef        refexport_t     (*GetRefAPI_t) (refimport_t);

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.