r_local.h (24348B)
1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 21 #include <stdio.h> 22 #include <stdlib.h> 23 #include <string.h> 24 #include <math.h> 25 #include <stdarg.h> 26 27 #include "../client/ref.h" 28 29 #define REF_VERSION "SOFT 0.01" 30 31 // up / down 32 #define PITCH 0 33 34 // left / right 35 #define YAW 1 36 37 // fall over 38 #define ROLL 2 39 40 41 /* 42 43 skins will be outline flood filled and mip mapped 44 pics and sprites with alpha will be outline flood filled 45 pic won't be mip mapped 46 47 model skin 48 sprite frame 49 wall texture 50 pic 51 52 */ 53 54 typedef enum 55 { 56 it_skin, 57 it_sprite, 58 it_wall, 59 it_pic, 60 it_sky 61 } imagetype_t; 62 63 typedef struct image_s 64 { 65 char name[MAX_QPATH]; // game path, including extension 66 imagetype_t type; 67 int width, height; 68 qboolean transparent; // true if any 255 pixels in image 69 int registration_sequence; // 0 = free 70 byte *pixels[4]; // mip levels 71 } image_t; 72 73 74 //=================================================================== 75 76 typedef unsigned char pixel_t; 77 78 typedef struct vrect_s 79 { 80 int x,y,width,height; 81 struct vrect_s *pnext; 82 } vrect_t; 83 84 typedef struct 85 { 86 pixel_t *buffer; // invisible buffer 87 pixel_t *colormap; // 256 * VID_GRADES size 88 pixel_t *alphamap; // 256 * 256 translucency map 89 int rowbytes; // may be > width if displayed in a window 90 // can be negative for stupid dibs 91 int width; 92 int height; 93 } viddef_t; 94 95 typedef enum 96 { 97 rserr_ok, 98 99 rserr_invalid_fullscreen, 100 rserr_invalid_mode, 101 102 rserr_unknown 103 } rserr_t; 104 105 extern viddef_t vid; 106 107 // !!! if this is changed, it must be changed in asm_draw.h too !!! 108 typedef struct 109 { 110 vrect_t vrect; // subwindow in video for refresh 111 // FIXME: not need vrect next field here? 112 vrect_t aliasvrect; // scaled Alias version 113 int vrectright, vrectbottom; // right & bottom screen coords 114 int aliasvrectright, aliasvrectbottom; // scaled Alias versions 115 float vrectrightedge; // rightmost right edge we care about, 116 // for use in edge list 117 float fvrectx, fvrecty; // for floating-point compares 118 float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping 119 int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20 120 int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20 121 float fvrectright_adj, fvrectbottom_adj; 122 // right and bottom edges, for clamping 123 float fvrectright; // rightmost edge, for Alias clamping 124 float fvrectbottom; // bottommost edge, for Alias clamping 125 float horizontalFieldOfView; // at Z = 1.0, this many X is visible 126 // 2.0 = 90 degrees 127 float xOrigin; // should probably always be 0.5 128 float yOrigin; // between be around 0.3 to 0.5 129 130 vec3_t vieworg; 131 vec3_t viewangles; 132 133 int ambientlight; 134 } oldrefdef_t; 135 136 extern oldrefdef_t r_refdef; 137 138 #include "r_model.h" 139 140 #define CACHE_SIZE 32 141 142 /* 143 ==================================================== 144 145 CONSTANTS 146 147 ==================================================== 148 */ 149 150 #define VID_CBITS 6 151 #define VID_GRADES (1 << VID_CBITS) 152 153 154 // r_shared.h: general refresh-related stuff shared between the refresh and the 155 // driver 156 157 158 #define MAXVERTS 64 // max points in a surface polygon 159 #define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate 160 // polygon (while processing) 161 // !!! if this is changed, it must be changed in d_ifacea.h too !!! 162 #define MAXHEIGHT 1200 163 #define MAXWIDTH 1600 164 165 #define INFINITE_DISTANCE 0x10000 // distance that's always guaranteed to 166 // be farther away than anything in 167 // the scene 168 169 170 // d_iface.h: interface header file for rasterization driver modules 171 172 #define WARP_WIDTH 320 173 #define WARP_HEIGHT 240 174 175 #define MAX_LBM_HEIGHT 480 176 177 178 #define PARTICLE_Z_CLIP 8.0 179 180 // !!! must be kept the same as in quakeasm.h !!! 181 #define TRANSPARENT_COLOR 0xFF 182 183 184 // !!! if this is changed, it must be changed in d_ifacea.h too !!! 185 #define TURB_TEX_SIZE 64 // base turbulent texture size 186 187 // !!! if this is changed, it must be changed in d_ifacea.h too !!! 188 #define CYCLE 128 // turbulent cycle size 189 190 #define SCANBUFFERPAD 0x1000 191 192 #define DS_SPAN_LIST_END -128 193 194 #define NUMSTACKEDGES 2000 195 #define MINEDGES NUMSTACKEDGES 196 #define NUMSTACKSURFACES 1000 197 #define MINSURFACES NUMSTACKSURFACES 198 #define MAXSPANS 3000 199 200 // flags in finalvert_t.flags 201 #define ALIAS_LEFT_CLIP 0x0001 202 #define ALIAS_TOP_CLIP 0x0002 203 #define ALIAS_RIGHT_CLIP 0x0004 204 #define ALIAS_BOTTOM_CLIP 0x0008 205 #define ALIAS_Z_CLIP 0x0010 206 #define ALIAS_XY_CLIP_MASK 0x000F 207 208 #define SURFCACHE_SIZE_AT_320X240 1024*768 209 210 #define BMODEL_FULLY_CLIPPED 0x10 // value returned by R_BmodelCheckBBox () 211 // if bbox is trivially rejected 212 213 #define XCENTERING (1.0 / 2.0) 214 #define YCENTERING (1.0 / 2.0) 215 216 #define CLIP_EPSILON 0.001 217 218 #define BACKFACE_EPSILON 0.01 219 220 // !!! if this is changed, it must be changed in asm_draw.h too !!! 221 #define NEAR_CLIP 0.01 222 223 224 #define MAXALIASVERTS 2000 // TODO: tune this 225 #define ALIAS_Z_CLIP_PLANE 4 226 227 // turbulence stuff 228 229 #define AMP 8*0x10000 230 #define AMP2 3 231 #define SPEED 20 232 233 234 /* 235 ==================================================== 236 237 TYPES 238 239 ==================================================== 240 */ 241 242 typedef struct 243 { 244 float u, v; 245 float s, t; 246 float zi; 247 } emitpoint_t; 248 249 /* 250 ** if you change this structure be sure to change the #defines 251 ** listed after it! 252 */ 253 #define SMALL_FINALVERT 0 254 255 #if SMALL_FINALVERT 256 257 typedef struct finalvert_s { 258 short u, v, s, t; 259 int l; 260 int zi; 261 int flags; 262 float xyz[3]; // eye space 263 } finalvert_t; 264 265 #define FINALVERT_V0 0 266 #define FINALVERT_V1 2 267 #define FINALVERT_V2 4 268 #define FINALVERT_V3 6 269 #define FINALVERT_V4 8 270 #define FINALVERT_V5 12 271 #define FINALVERT_FLAGS 16 272 #define FINALVERT_X 20 273 #define FINALVERT_Y 24 274 #define FINALVERT_Z 28 275 #define FINALVERT_SIZE 32 276 277 #else 278 279 typedef struct finalvert_s { 280 int u, v, s, t; 281 int l; 282 int zi; 283 int flags; 284 float xyz[3]; // eye space 285 } finalvert_t; 286 287 #define FINALVERT_V0 0 288 #define FINALVERT_V1 4 289 #define FINALVERT_V2 8 290 #define FINALVERT_V3 12 291 #define FINALVERT_V4 16 292 #define FINALVERT_V5 20 293 #define FINALVERT_FLAGS 24 294 #define FINALVERT_X 28 295 #define FINALVERT_Y 32 296 #define FINALVERT_Z 36 297 #define FINALVERT_SIZE 40 298 299 #endif 300 301 typedef struct 302 { 303 void *pskin; 304 int pskindesc; 305 int skinwidth; 306 int skinheight; 307 dtriangle_t *ptriangles; 308 finalvert_t *pfinalverts; 309 int numtriangles; 310 int drawtype; 311 int seamfixupX16; 312 qboolean do_vis_thresh; 313 int vis_thresh; 314 } affinetridesc_t; 315 316 typedef struct 317 { 318 byte *surfdat; // destination for generated surface 319 int rowbytes; // destination logical width in bytes 320 msurface_t *surf; // description for surface to generate 321 fixed8_t lightadj[MAXLIGHTMAPS]; 322 // adjust for lightmap levels for dynamic lighting 323 image_t *image; 324 int surfmip; // mipmapped ratio of surface texels / world pixels 325 int surfwidth; // in mipmapped texels 326 int surfheight; // in mipmapped texels 327 } drawsurf_t; 328 329 330 331 typedef struct { 332 int ambientlight; 333 int shadelight; 334 float *plightvec; 335 } alight_t; 336 337 // clipped bmodel edges 338 339 typedef struct bedge_s 340 { 341 mvertex_t *v[2]; 342 struct bedge_s *pnext; 343 } bedge_t; 344 345 346 // !!! if this is changed, it must be changed in asm_draw.h too !!! 347 typedef struct clipplane_s 348 { 349 vec3_t normal; 350 float dist; 351 struct clipplane_s *next; 352 byte leftedge; 353 byte rightedge; 354 byte reserved[2]; 355 } clipplane_t; 356 357 358 typedef struct surfcache_s 359 { 360 struct surfcache_s *next; 361 struct surfcache_s **owner; // NULL is an empty chunk of memory 362 int lightadj[MAXLIGHTMAPS]; // checked for strobe flush 363 int dlight; 364 int size; // including header 365 unsigned width; 366 unsigned height; // DEBUG only needed for debug 367 float mipscale; 368 image_t *image; 369 byte data[4]; // width*height elements 370 } surfcache_t; 371 372 // !!! if this is changed, it must be changed in asm_draw.h too !!! 373 typedef struct espan_s 374 { 375 int u, v, count; 376 struct espan_s *pnext; 377 } espan_t; 378 379 // used by the polygon drawer (R_POLY.C) and sprite setup code (R_SPRITE.C) 380 typedef struct 381 { 382 int nump; 383 emitpoint_t *pverts; 384 byte *pixels; // image 385 int pixel_width; // image width 386 int pixel_height; // image height 387 vec3_t vup, vright, vpn; // in worldspace, for plane eq 388 float dist; 389 float s_offset, t_offset; 390 float viewer_position[3]; 391 void (*drawspanlet)( void ); 392 int stipple_parity; 393 } polydesc_t; 394 395 // FIXME: compress, make a union if that will help 396 // insubmodel is only 1, flags is fewer than 32, spanstate could be a byte 397 typedef struct surf_s 398 { 399 struct surf_s *next; // active surface stack in r_edge.c 400 struct surf_s *prev; // used in r_edge.c for active surf stack 401 struct espan_s *spans; // pointer to linked list of spans to draw 402 int key; // sorting key (BSP order) 403 int last_u; // set during tracing 404 int spanstate; // 0 = not in span 405 // 1 = in span 406 // -1 = in inverted span (end before 407 // start) 408 int flags; // currentface flags 409 msurface_t *msurf; 410 entity_t *entity; 411 float nearzi; // nearest 1/z on surface, for mipmapping 412 qboolean insubmodel; 413 float d_ziorigin, d_zistepu, d_zistepv; 414 415 int pad[2]; // to 64 bytes 416 } surf_t; 417 418 // !!! if this is changed, it must be changed in asm_draw.h too !!! 419 typedef struct edge_s 420 { 421 fixed16_t u; 422 fixed16_t u_step; 423 struct edge_s *prev, *next; 424 unsigned short surfs[2]; 425 struct edge_s *nextremove; 426 float nearzi; 427 medge_t *owner; 428 } edge_t; 429 430 431 /* 432 ==================================================== 433 434 VARS 435 436 ==================================================== 437 */ 438 439 extern int d_spanpixcount; 440 extern int r_framecount; // sequence # of current frame since Quake 441 // started 442 extern float r_aliasuvscale; // scale-up factor for screen u and v 443 // on Alias vertices passed to driver 444 extern qboolean r_dowarp; 445 446 extern affinetridesc_t r_affinetridesc; 447 448 extern vec3_t r_pright, r_pup, r_ppn; 449 450 void D_DrawSurfaces (void); 451 void R_DrawParticle( void ); 452 void D_ViewChanged (void); 453 void D_WarpScreen (void); 454 void R_PolysetUpdateTables (void); 455 456 extern void *acolormap; // FIXME: should go away 457 458 //=======================================================================// 459 460 // callbacks to Quake 461 462 extern drawsurf_t r_drawsurf; 463 464 void R_DrawSurface (void); 465 466 extern int c_surf; 467 468 extern byte r_warpbuffer[WARP_WIDTH * WARP_HEIGHT]; 469 470 471 472 473 extern float scale_for_mip; 474 475 extern qboolean d_roverwrapped; 476 extern surfcache_t *sc_rover; 477 extern surfcache_t *d_initial_rover; 478 479 extern float d_sdivzstepu, d_tdivzstepu, d_zistepu; 480 extern float d_sdivzstepv, d_tdivzstepv, d_zistepv; 481 extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin; 482 483 extern fixed16_t sadjust, tadjust; 484 extern fixed16_t bbextents, bbextentt; 485 486 487 void D_DrawSpans16 (espan_t *pspans); 488 void D_DrawZSpans (espan_t *pspans); 489 void Turbulent8 (espan_t *pspan); 490 void NonTurbulent8 (espan_t *pspan); //PGM 491 492 surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel); 493 494 extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; 495 496 extern int d_pix_min, d_pix_max, d_pix_shift; 497 498 extern pixel_t *d_viewbuffer; 499 extern short *d_pzbuffer; 500 extern unsigned int d_zrowbytes, d_zwidth; 501 extern short *zspantable[MAXHEIGHT]; 502 extern int d_scantable[MAXHEIGHT]; 503 504 extern int d_minmip; 505 extern float d_scalemip[3]; 506 507 //=================================================================== 508 509 extern int cachewidth; 510 extern pixel_t *cacheblock; 511 extern int r_screenwidth; 512 513 extern int r_drawnpolycount; 514 515 extern int sintable[1280]; 516 extern int intsintable[1280]; 517 extern int blanktable[1280]; // PGM 518 519 extern vec3_t vup, base_vup; 520 extern vec3_t vpn, base_vpn; 521 extern vec3_t vright, base_vright; 522 523 extern surf_t *surfaces, *surface_p, *surf_max; 524 525 // surfaces are generated in back to front order by the bsp, so if a surf 526 // pointer is greater than another one, it should be drawn in front 527 // surfaces[1] is the background, and is used as the active surface stack. 528 // surfaces[0] is a dummy, because index 0 is used to indicate no surface 529 // attached to an edge_t 530 531 //=================================================================== 532 533 extern vec3_t sxformaxis[4]; // s axis transformed into viewspace 534 extern vec3_t txformaxis[4]; // t axis transformed into viewspac 535 536 extern float xcenter, ycenter; 537 extern float xscale, yscale; 538 extern float xscaleinv, yscaleinv; 539 extern float xscaleshrink, yscaleshrink; 540 541 extern void TransformVector (vec3_t in, vec3_t out); 542 extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv, 543 fixed8_t endvertu, fixed8_t endvertv); 544 545 extern int ubasestep, errorterm, erroradjustup, erroradjustdown; 546 547 //=========================================================================== 548 549 extern cvar_t *sw_aliasstats; 550 extern cvar_t *sw_clearcolor; 551 extern cvar_t *sw_drawflat; 552 extern cvar_t *sw_draworder; 553 extern cvar_t *sw_maxedges; 554 extern cvar_t *sw_maxsurfs; 555 extern cvar_t *sw_mipcap; 556 extern cvar_t *sw_mipscale; 557 extern cvar_t *sw_mode; 558 extern cvar_t *sw_reportsurfout; 559 extern cvar_t *sw_reportedgeout; 560 extern cvar_t *sw_stipplealpha; 561 extern cvar_t *sw_surfcacheoverride; 562 extern cvar_t *sw_waterwarp; 563 564 extern cvar_t *r_fullbright; 565 extern cvar_t *r_lefthand; 566 extern cvar_t *r_drawentities; 567 extern cvar_t *r_drawworld; 568 extern cvar_t *r_dspeeds; 569 extern cvar_t *r_lerpmodels; 570 571 extern cvar_t *r_speeds; 572 573 extern cvar_t *r_lightlevel; //FIXME HACK 574 575 extern cvar_t *vid_fullscreen; 576 extern cvar_t *vid_gamma; 577 578 579 extern clipplane_t view_clipplanes[4]; 580 extern int *pfrustum_indexes[4]; 581 582 583 //============================================================================= 584 585 void R_RenderWorld (void); 586 587 //============================================================================= 588 589 extern mplane_t screenedge[4]; 590 591 extern vec3_t r_origin; 592 593 extern entity_t r_worldentity; 594 extern model_t *currentmodel; 595 extern entity_t *currententity; 596 extern vec3_t modelorg; 597 extern vec3_t r_entorigin; 598 599 extern float verticalFieldOfView; 600 extern float xOrigin, yOrigin; 601 602 extern int r_visframecount; 603 604 extern msurface_t *r_alpha_surfaces; 605 606 //============================================================================= 607 608 void R_ClearPolyList (void); 609 void R_DrawPolyList (void); 610 611 // 612 // current entity info 613 // 614 extern qboolean insubmodel; 615 616 void R_DrawAlphaSurfaces( void ); 617 618 void R_DrawSprite (void); 619 void R_DrawBeam( entity_t *e ); 620 621 void R_RenderFace (msurface_t *fa, int clipflags); 622 void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf); 623 void R_TransformPlane (mplane_t *p, float *normal, float *dist); 624 void R_TransformFrustum (void); 625 void R_DrawSurfaceBlock16 (void); 626 void R_DrawSurfaceBlock8 (void); 627 628 #if id386 629 630 void R_DrawSurfaceBlock8_mip0 (void); 631 void R_DrawSurfaceBlock8_mip1 (void); 632 void R_DrawSurfaceBlock8_mip2 (void); 633 void R_DrawSurfaceBlock8_mip3 (void); 634 635 #endif 636 637 void R_GenSkyTile (void *pdest); 638 void R_GenSkyTile16 (void *pdest); 639 void R_Surf8Patch (void); 640 void R_Surf16Patch (void); 641 void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags, mnode_t *topnode); 642 void R_DrawSolidClippedSubmodelPolygons (model_t *pmodel, mnode_t *topnode); 643 644 void R_AddPolygonEdges (emitpoint_t *pverts, int numverts, int miplevel); 645 surf_t *R_GetSurf (void); 646 void R_AliasDrawModel (void); 647 void R_BeginEdgeFrame (void); 648 void R_ScanEdges (void); 649 void D_DrawSurfaces (void); 650 void R_InsertNewEdges (edge_t *edgestoadd, edge_t *edgelist); 651 void R_StepActiveU (edge_t *pedge); 652 void R_RemoveEdges (edge_t *pedge); 653 void R_PushDlights (model_t *model); 654 655 extern void R_Surf8Start (void); 656 extern void R_Surf8End (void); 657 extern void R_Surf16Start (void); 658 extern void R_Surf16End (void); 659 extern void R_EdgeCodeStart (void); 660 extern void R_EdgeCodeEnd (void); 661 662 extern void R_RotateBmodel (void); 663 664 extern int c_faceclip; 665 extern int r_polycount; 666 extern int r_wholepolycount; 667 668 extern int ubasestep, errorterm, erroradjustup, erroradjustdown; 669 670 extern fixed16_t sadjust, tadjust; 671 extern fixed16_t bbextents, bbextentt; 672 673 extern mvertex_t *r_ptverts, *r_ptvertsmax; 674 675 extern float entity_rotation[3][3]; 676 677 extern int r_currentkey; 678 extern int r_currentbkey; 679 680 void R_InitTurb (void); 681 682 void R_DrawParticles (void); 683 void R_SurfacePatch (void); 684 685 extern int r_amodels_drawn; 686 extern edge_t *auxedges; 687 extern int r_numallocatededges; 688 extern edge_t *r_edges, *edge_p, *edge_max; 689 690 extern edge_t *newedges[MAXHEIGHT]; 691 extern edge_t *removeedges[MAXHEIGHT]; 692 693 // FIXME: make stack vars when debugging done 694 extern edge_t edge_head; 695 extern edge_t edge_tail; 696 extern edge_t edge_aftertail; 697 698 extern int r_aliasblendcolor; 699 700 extern float aliasxscale, aliasyscale, aliasxcenter, aliasycenter; 701 702 extern int r_outofsurfaces; 703 extern int r_outofedges; 704 705 extern mvertex_t *r_pcurrentvertbase; 706 extern int r_maxvalidedgeoffset; 707 708 typedef struct 709 { 710 finalvert_t *a, *b, *c; 711 } aliastriangleparms_t; 712 713 extern aliastriangleparms_t aliastriangleparms; 714 715 void R_DrawTriangle( void ); 716 //void R_DrawTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2); 717 void R_AliasClipTriangle (finalvert_t *index0, finalvert_t *index1, finalvert_t *index2); 718 719 720 extern float r_time1; 721 extern float da_time1, da_time2; 722 extern float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2; 723 extern float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2; 724 extern int r_frustum_indexes[4*6]; 725 extern int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs; 726 extern qboolean r_surfsonstack; 727 728 extern mleaf_t *r_viewleaf; 729 extern int r_viewcluster, r_oldviewcluster; 730 731 extern int r_clipflags; 732 extern int r_dlightframecount; 733 extern qboolean r_fov_greater_than_90; 734 735 extern image_t *r_notexture_mip; 736 extern model_t *r_worldmodel; 737 738 void R_PrintAliasStats (void); 739 void R_PrintTimes (void); 740 void R_PrintDSpeeds (void); 741 void R_AnimateLight (void); 742 void R_LightPoint (vec3_t p, vec3_t color); 743 void R_SetupFrame (void); 744 void R_cshift_f (void); 745 void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1); 746 void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip); 747 void R_SplitEntityOnNode2 (mnode_t *node); 748 749 extern refdef_t r_newrefdef; 750 751 extern surfcache_t *sc_rover, *sc_base; 752 753 extern void *colormap; 754 755 //==================================================================== 756 757 float R_DLightPoint (vec3_t p); 758 759 void R_NewMap (void); 760 void R_Register (void); 761 void R_UnRegister (void); 762 void Draw_InitLocal (void); 763 qboolean R_Init( void *hInstance, void *wndProc ); 764 void R_Shutdown (void); 765 void R_InitCaches (void); 766 void D_FlushCaches (void); 767 768 void R_ScreenShot_f( void ); 769 void R_BeginRegistration (char *map); 770 struct model_s *R_RegisterModel (char *name); 771 void R_EndRegistration (void); 772 773 void R_RenderFrame (refdef_t *fd); 774 775 struct image_s *Draw_FindPic (char *name); 776 777 void Draw_GetPicSize (int *w, int *h, char *name); 778 void Draw_Pic (int x, int y, char *name); 779 void Draw_StretchPic (int x, int y, int w, int h, char *name); 780 void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte *data); 781 void Draw_Char (int x, int y, int c); 782 void Draw_TileClear (int x, int y, int w, int h, char *name); 783 void Draw_Fill (int x, int y, int w, int h, int c); 784 void Draw_FadeScreen (void); 785 786 void Draw_GetPalette (void); 787 788 void R_BeginFrame( float camera_separation ); 789 790 void R_CinematicSetPalette( const unsigned char *palette ); 791 792 extern unsigned d_8to24table[256]; // base 793 794 void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length); 795 void Sys_SetFPCW (void); 796 797 void LoadPCX (char *filename, byte **pic, byte **palette, int *width, int *height); 798 799 void R_InitImages (void); 800 void R_ShutdownImages (void); 801 image_t *R_FindImage (char *name, imagetype_t type); 802 void R_FreeUnusedImages (void); 803 804 void R_GammaCorrectAndSetPalette( const unsigned char *pal ); 805 806 extern mtexinfo_t *sky_texinfo[6]; 807 808 void R_InitSkyBox (void); 809 810 typedef struct swstate_s 811 { 812 qboolean fullscreen; 813 int prev_mode; // last valid SW mode 814 815 byte gammatable[256]; 816 byte currentpalette[1024]; 817 818 } swstate_t; 819 820 void R_IMFlatShadedQuad( vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, float alpha ); 821 822 extern swstate_t sw_state; 823 824 /* 825 ==================================================================== 826 827 IMPORTED FUNCTIONS 828 829 ==================================================================== 830 */ 831 832 extern refimport_t ri; 833 834 /* 835 ==================================================================== 836 837 IMPLEMENTATION FUNCTIONS 838 839 ==================================================================== 840 */ 841 842 void SWimp_BeginFrame( float camera_separation ); 843 void SWimp_EndFrame (void); 844 int SWimp_Init( void *hInstance, void *wndProc ); 845 void SWimp_SetPalette( const unsigned char *palette); 846 void SWimp_Shutdown( void ); 847 rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen ); 848 void SWimp_AppActivate( qboolean active ); 849