A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9418 a1c6a512-1295-4272-9138-f99709370657

+567 -535
+10 -10
apps/plugins/doom/d_main.c
··· 629 else if (M_CheckParm ("-deathmatch")) 630 deathmatch = 1; 631 632 - printf("Welcome to Rockdoom"); 633 634 switch ( gamemode ) 635 { 636 case retail: 637 - printf ("The Ultimate DOOM Startup v%d.%d",DVERSION/100,DVERSION%100); 638 break; 639 case shareware: 640 - printf ("DOOM Shareware Startup v%d.%d",DVERSION/100,DVERSION%100); 641 break; 642 case registered: 643 - printf ("DOOM Registered Startup v%d.%d",DVERSION/100,DVERSION%100); 644 break; 645 case commercial: 646 switch (gamemission) 647 { 648 case pack_plut: 649 - printf ("DOOM 2: Plutonia Experiment v%d.%d",DVERSION/100,DVERSION%100); 650 break; 651 case pack_tnt: 652 - printf ("DOOM 2: TNT - Evilution v%d.%d",DVERSION/100,DVERSION%100); 653 break; 654 default: 655 - printf ("DOOM 2: Hell on Earth v%d.%d",DVERSION/100,DVERSION%100); 656 break; 657 } 658 break; 659 default: 660 - printf ("Public DOOM v%d.%d",DVERSION/100,DVERSION%100); 661 break; 662 } 663 ··· 745 int i; 746 747 if ( gamemode == shareware) 748 - I_Error("\nYou cannot -file with the shareware version. Register!"); 749 750 // Check for fake IWAD with right name, 751 // but w/o all the lumps of the registered version. 752 if (gamemode == registered) 753 for (i = 0;i < 23; i++) 754 if (W_CheckNumForName(name[i])<0) 755 - I_Error("\nThis is not the registered version."); 756 } 757 758 // Iff additonal PWAD files are used, print modified banner
··· 629 else if (M_CheckParm ("-deathmatch")) 630 deathmatch = 1; 631 632 + printf("Welcome to Rockdoom\n"); 633 634 switch ( gamemode ) 635 { 636 case retail: 637 + printf ("The Ultimate DOOM Startup v%d.%d\n",DVERSION/100,DVERSION%100); 638 break; 639 case shareware: 640 + printf ("DOOM Shareware Startup v%d.%d\n",DVERSION/100,DVERSION%100); 641 break; 642 case registered: 643 + printf ("DOOM Registered Startup v%d.%d\n",DVERSION/100,DVERSION%100); 644 break; 645 case commercial: 646 switch (gamemission) 647 { 648 case pack_plut: 649 + printf ("DOOM 2: Plutonia Experiment v%d.%d\n",DVERSION/100,DVERSION%100); 650 break; 651 case pack_tnt: 652 + printf ("DOOM 2: TNT - Evilution v%d.%d\n",DVERSION/100,DVERSION%100); 653 break; 654 default: 655 + printf ("DOOM 2: Hell on Earth v%d.%d\n",DVERSION/100,DVERSION%100); 656 break; 657 } 658 break; 659 default: 660 + printf ("Public DOOM v%d.%d\n",DVERSION/100,DVERSION%100); 661 break; 662 } 663 ··· 745 int i; 746 747 if ( gamemode == shareware) 748 + I_Error("\nYou cannot -file with the shareware version. Register!\n"); 749 750 // Check for fake IWAD with right name, 751 // but w/o all the lumps of the registered version. 752 if (gamemode == registered) 753 for (i = 0;i < 23; i++) 754 if (W_CheckNumForName(name[i])<0) 755 + I_Error("This is not the registered version.\n"); 756 } 757 758 // Iff additonal PWAD files are used, print modified banner
+4 -2
apps/plugins/doom/doomdef.h
··· 92 #define MAX_SCREENWIDTH 1600 93 #define MAX_SCREENHEIGHT 1200 94 95 - #define SCREENWIDTH 320 96 - #define SCREENHEIGHT 200 97 98 // The maximum number of players, multiplayer/networking. 99 #define MAXPLAYERS 4
··· 92 #define MAX_SCREENWIDTH 1600 93 #define MAX_SCREENHEIGHT 1200 94 95 + #define SCREENWIDTH LCD_WIDTH 96 + //#define SCREENWIDTH 320 97 + //#define SCREENHEIGHT 200 98 + #define SCREENHEIGHT LCD_HEIGHT 99 100 // The maximum number of players, multiplayer/networking. 101 #define MAXPLAYERS 4
+5 -2
apps/plugins/doom/i_system.c
··· 16 // GNU General Public License for more details. 17 // 18 // $Log$ 19 - // Revision 1.1 2006/03/28 15:44:01 dave 20 // Patch #2969 - Doom! Currently only working on the H300. 21 // 22 // ··· 120 vsnprintf(p_buf,sizeof(p_buf), error, ap); 121 va_end(ap); 122 123 - printf("%s",p_buf); 124 125 // Shutdown. Here might be other errors. 126 if (demorecording)
··· 16 // GNU General Public License for more details. 17 // 18 // $Log$ 19 + // Revision 1.2 2006/04/02 01:52:44 kkurbjun 20 + // Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting. 21 + // 22 + // Revision 1.1 2006-03-28 15:44:01 dave 23 // Patch #2969 - Doom! Currently only working on the H300. 24 // 25 // ··· 123 vsnprintf(p_buf,sizeof(p_buf), error, ap); 124 va_end(ap); 125 126 + printf("%s\n",p_buf); 127 128 // Shutdown. Here might be other errors. 129 if (demorecording)
+16 -80
apps/plugins/doom/i_video.c
··· 16 * GNU General Public License for more details. 17 * 18 * $Log$ 19 - * Revision 1.2 2006/03/28 17:20:49 christian 20 * added good (tm) button mappings for x5, and added ifdef for HAS_BUTTON_HOLD 21 * 22 * Revision 1.1 2006-03-28 15:44:01 dave ··· 40 #include "doomdef.h" 41 42 #include "rockmacros.h" 43 - 44 static fb_data palette[256] IBSS_ATTR; 45 static fb_data *paldata=NULL; 46 - 47 - #if !defined(CPU_COLDFIRE) || defined(SIMULATOR) 48 - /* 49 - This code is credit to the IDOOM port. It is not used for the H300, but 50 - serves as a good reference point for other targets. 51 - */ 52 - static fb_data * xtable = 0; 53 - static fb_data * ytable1 = 0; 54 - static fb_data * ytable2 = 0; 55 - 56 - #define FLOOR4(a) \ 57 - (( a >> 2) << 2) 58 - 59 - static int video_w, video_h; 60 - 61 - static void genscalexytable(void) 62 - { 63 - // shall we use uint8_t intead of ints? 64 - int y = video_h-1; 65 - int x = video_w-1; 66 - int i = 1 + (x>y?x:y); 67 - xtable = malloc(sizeof(int)*video_w ); 68 - ytable1 = malloc(sizeof(int)*video_h ); 69 - ytable2 = malloc(sizeof(int)*video_h ); 70 - 71 - while(i--) 72 - { 73 - if(y>=0) 74 - { 75 - ytable1[y] = ((y*SCREENHEIGHT) / video_h) * SCREENWIDTH; 76 - ytable2[y] = y*video_w; 77 - y--; 78 - } 79 - if(x>=0) 80 - { 81 - xtable[x] = (x*SCREENWIDTH) / video_w; 82 - x--; 83 - } 84 - } 85 - } 86 - #endif 87 88 // 89 // I_ShutdownGraphics (NOT USED) ··· 360 { 361 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 362 /* 363 - Faster screen update than the lookuptables -> I'm wasting 7 pixels of width 364 - though. This code also doesn't use the framebuffer so rockbox's drawing 365 - functions will not work on top of the doom drawing. 366 */ 367 368 // Start the write ··· 373 unsigned char *screenptr=screens[0]; 374 int wcnt=0, hcnt=0; 375 376 - *(volatile unsigned short *) 0xf0000002 = 0; 377 - *(volatile unsigned short *) 0xf0000002 = 0; 378 - *(volatile unsigned short *) 0xf0000002 = 0; 379 - 380 while(hcnt<LCD_HEIGHT) 381 { 382 - while(wcnt<LCD_WIDTH-7) 383 { 384 - if((wcnt&0x01)) 385 - screenptr++; // Skip every so many pixels in Doom buffer 386 *(volatile unsigned short *)0xf0000002 = palette[*screenptr]; 387 screenptr++; 388 wcnt++; 389 } 390 - screenptr++; 391 - // move on past those 7 pixels 392 - *(volatile unsigned short *) 0xf0000002 = 0; 393 - *(volatile unsigned short *) 0xf0000002 = 0; 394 - *(volatile unsigned short *) 0xf0000002 = 0; 395 - *(volatile unsigned short *) 0xf0000002 = 0; 396 - *(volatile unsigned short *) 0xf0000002 = 0; 397 - *(volatile unsigned short *) 0xf0000002 = 0; 398 - *(volatile unsigned short *) 0xf0000002 = 0; 399 wcnt=0; 400 hcnt++; 401 - if((hcnt&0x07)==0x07) 402 - screenptr+=SCREENWIDTH; // Skip every 7th line 403 } 404 #else 405 - // The IDOOM code for screen updates 406 unsigned char paletteIndex; 407 int x, y; 408 409 - for (y = 0; y < video_h; y++) 410 { 411 - for (x = 0; x < video_w; x++) 412 { 413 - #if LCD_HEIGHT >= SCREENHEIGHT 414 - paletteIndex = screens[0][((y*SCREENHEIGHT) / video_h) 415 - * SCREENWIDTH + x]; 416 - rb->lcd_framebuffer[y * video_w + x] = palette[paletteIndex]; 417 - #else 418 - paletteIndex = screens[0][ytable1[y] +xtable[x]]; 419 - rb->lcd_framebuffer[x + ytable2[y]] = palette[paletteIndex]; 420 - #endif 421 } 422 } 423 rb->lcd_update(); ··· 454 printf("Starting Graphics engine\n"); 455 456 /* Note: The other screens are initialized later */ 457 - screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char)); 458 459 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 460 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); 461 #else 462 - 463 - video_h = LCD_HEIGHT; 464 - video_w = FLOOR4(LCD_WIDTH); // From IDOOM, the width has to be a multiple of 4 465 - genscalexytable(); 466 #endif 467 }
··· 16 * GNU General Public License for more details. 17 * 18 * $Log$ 19 + * Revision 1.3 2006/04/02 01:52:44 kkurbjun 20 + * Update adds prboom's high resolution support, also makes the scaling for platforms w/ resolution less then 320x200 much nicer. IDoom's lookup table code has been removed. Also fixed a pallete bug. Some graphic errors are present in menu and status bar. Also updates some headers and output formatting. 21 + * 22 + * Revision 1.2 2006-03-28 17:20:49 christian 23 * added good (tm) button mappings for x5, and added ifdef for HAS_BUTTON_HOLD 24 * 25 * Revision 1.1 2006-03-28 15:44:01 dave ··· 43 #include "doomdef.h" 44 45 #include "rockmacros.h" 46 + #if defined(CPU_COLDFIRE) 47 + static char fastscreen[LCD_WIDTH*LCD_HEIGHT] IBSS_ATTR; 48 + #endif 49 static fb_data palette[256] IBSS_ATTR; 50 static fb_data *paldata=NULL; 51 52 // 53 // I_ShutdownGraphics (NOT USED) ··· 324 { 325 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 326 /* 327 + Lookup tables are no longer needed 328 */ 329 330 // Start the write ··· 335 unsigned char *screenptr=screens[0]; 336 int wcnt=0, hcnt=0; 337 338 while(hcnt<LCD_HEIGHT) 339 { 340 + while(wcnt<LCD_WIDTH) 341 { 342 *(volatile unsigned short *)0xf0000002 = palette[*screenptr]; 343 screenptr++; 344 wcnt++; 345 } 346 wcnt=0; 347 hcnt++; 348 } 349 #else 350 unsigned char paletteIndex; 351 int x, y; 352 353 + for (y = 0; y < LCD_HEIGHT; y++) 354 { 355 + for (x = 0; x < LCD_WIDTH; x++) 356 { 357 + paletteIndex = screens[0][y*SCREENWIDTH + x]; 358 + rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; 359 } 360 } 361 rb->lcd_update(); ··· 392 printf("Starting Graphics engine\n"); 393 394 /* Note: The other screens are initialized later */ 395 396 #if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 397 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); 398 + screens[0] = fastscreen; 399 #else 400 + // Don't know if this will fit in other IRAMs 401 + screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char)); 402 #endif 403 }
+64 -40
apps/plugins/doom/r_bsp.c
··· 29 * 30 *-----------------------------------------------------------------------------*/ 31 32 - #include "doomdef.h" 33 - 34 #include "m_bbox.h" 35 - 36 #include "i_system.h" 37 - 38 #include "r_main.h" 39 #include "r_plane.h" 40 #include "r_things.h" 41 - 42 - // State. 43 - #include "doomstat.h" 44 - #include "r_state.h" 45 - #include "r_segs.h" 46 - #include "rockmacros.h" 47 48 seg_t *curline; 49 side_t *sidedef; ··· 52 sector_t *backsector; 53 drawseg_t *ds_p; 54 55 56 drawseg_t *drawsegs; 57 unsigned maxdrawsegs; 58 59 // 60 // R_ClearDrawSegs 61 // 62 - void R_ClearDrawSegs (void) 63 { 64 ds_p = drawsegs; 65 } ··· 79 void R_ClipWallSegment(int first, int last, boolean solid) 80 { 81 byte *p; 82 - while (first < last) { 83 - if (solidcol[first]) { 84 - if (!(p = memchr(solidcol+first, 0, last-first))) return; // All solid 85 first = p - solidcol; 86 - } else { 87 int to; 88 - if (!(p = memchr(solidcol+first, 1, last-first))) to = last; 89 - else to = p - solidcol; 90 R_StoreWallRange(first, to-1); 91 - if (solid) { 92 memset(solidcol+first,1,to-first); 93 } 94 first = to; ··· 136 ) 137 ) 138 linedef->r_flags = RF_CLOSED; 139 - else { 140 // Reject empty lines used for triggers 141 // and special events. 142 // Identical floor and ceiling on both sides, ··· 151 sizeof(frontsector->ceiling_xoffs) + sizeof(frontsector->ceiling_yoffs) + 152 sizeof(frontsector->ceilingpic) + sizeof(frontsector->floorpic) + 153 sizeof(frontsector->lightlevel) + sizeof(frontsector->floorlightsec) + 154 - sizeof(frontsector->ceilinglightsec))) { 155 - linedef->r_flags = 0; return; 156 - } else 157 linedef->r_flags = RF_IGNORE; 158 } 159 160 /* cph - I'm too lazy to try and work with offsets in this */ 161 - if (curline->sidedef->rowoffset) return; 162 163 /* Now decide on texture tiling */ 164 - if (linedef->flags & ML_TWOSIDED) { 165 int c; 166 167 /* Does top texture need tiling */ ··· 173 if ((c = frontsector->floorheight - backsector->floorheight) > 0 && 174 (textureheight[texturetranslation[curline->sidedef->bottomtexture]] > c)) 175 linedef->r_flags |= RF_BOT_TILE; 176 - } else { 177 int c; 178 /* Does middle texture need tiling */ 179 if ((c = frontsector->ceilingheight - frontsector->floorheight) > 0 && ··· 228 tempsec->floor_xoffs = s->floor_xoffs; 229 tempsec->floor_yoffs = s->floor_yoffs; 230 231 - if (underwater) { 232 - if (s->ceilingpic == skyflatnum) { 233 tempsec->floorheight = tempsec->ceilingheight+1; 234 tempsec->ceilingpic = tempsec->floorpic; 235 tempsec->ceiling_xoffs = tempsec->floor_xoffs; 236 tempsec->ceiling_yoffs = tempsec->floor_yoffs; 237 - } else { 238 tempsec->ceilingpic = s->ceilingpic; 239 tempsec->ceiling_xoffs = s->ceiling_xoffs; 240 tempsec->ceiling_yoffs = s->ceiling_yoffs; ··· 384 385 static const int checkcoord[12][4] = // killough -- static const 386 { 387 - {3,0,2,1}, 388 {3,0,2,0}, 389 {3,1,2,0}, 390 {0}, ··· 421 422 // cph - replaced old code, which was unclear and badly commented 423 // Much more efficient code now 424 - if ((signed)angle1 < (signed)angle2) { /* it's "behind" us */ 425 /* Either angle1 or angle2 is behind us, so it doesn't matter if we 426 * change it to the corect sign 427 */ ··· 431 angle2 = INT_MIN; 432 } 433 434 - if ((signed)angle2 >= (signed)clipangle) return false; // Both off left edge 435 - if ((signed)angle1 <= -(signed)clipangle) return false; // Both off right edge 436 - if ((signed)angle1 >= (signed)clipangle) angle1 = clipangle; // Clip at left edge 437 - if ((signed)angle2 <= -(signed)clipangle) angle2 = 0-clipangle; // Clip at right edge 438 439 // Find the first clippost 440 // that touches the source post ··· 450 if (sx1 == sx2) 451 return false; 452 453 - if (!memchr(solidcol+sx1, 0, sx2-sx1)) return false; 454 // All columns it covers are already solidly covered 455 } 456 ··· 477 int ceilinglightlevel; // killough 4/11/98 478 479 #ifdef RANGECHECK 480 if (num>=numsubsectors) 481 I_Error ("R_Subsector: ss %i with numss = %i", num, numsubsectors); 482 #endif ··· 485 frontsector = sub->sector; 486 count = sub->numlines; 487 line = &segs[sub->firstline]; 488 - // sscount++; 489 490 // killough 3/8/98, 4/4/98: Deep water / fake ceiling effect 491 frontsector = R_FakeFlat(frontsector, &tempsec, &floorlightlevel, ··· 497 498 floorplane = frontsector->floorheight < viewz || // killough 3/7/98 499 (frontsector->heightsec != -1 && 500 - sectors[frontsector->heightsec].ceilingpic == skyflatnum) 501 - ? 502 R_FindPlane(frontsector->floorheight, 503 frontsector->floorpic == skyflatnum && // kilough 10/98 504 frontsector->sky & PL_SKYFLAT ? frontsector->sky : ··· 511 ceilingplane = frontsector->ceilingheight > viewz || 512 frontsector->ceilingpic == skyflatnum || 513 (frontsector->heightsec != -1 && 514 - sectors[frontsector->heightsec].floorpic == skyflatnum) 515 - ? 516 R_FindPlane(frontsector->ceilingheight, // killough 3/8/98 517 frontsector->ceilingpic == skyflatnum && // kilough 10/98 518 frontsector->sky & PL_SKYFLAT ? frontsector->sky :
··· 29 * 30 *-----------------------------------------------------------------------------*/ 31 32 + #include "doomstat.h" 33 #include "m_bbox.h" 34 #include "i_system.h" 35 #include "r_main.h" 36 + #include "r_segs.h" 37 #include "r_plane.h" 38 #include "r_things.h" 39 + #include "r_bsp.h" // cph - sanity checking 40 41 seg_t *curline; 42 side_t *sidedef; ··· 45 sector_t *backsector; 46 drawseg_t *ds_p; 47 48 + // killough 4/7/98: indicates doors closed wrt automap bugfix: 49 + // cph - replaced by linedef rendering flags - int doorclosed; 50 51 + // killough: New code which removes 2s linedef limit 52 drawseg_t *drawsegs; 53 unsigned maxdrawsegs; 54 + // drawseg_t drawsegs[MAXDRAWSEGS]; // old code -- killough 55 56 // 57 // R_ClearDrawSegs 58 // 59 + 60 + void R_ClearDrawSegs(void) 61 { 62 ds_p = drawsegs; 63 } ··· 77 void R_ClipWallSegment(int first, int last, boolean solid) 78 { 79 byte *p; 80 + while (first < last) 81 + { 82 + if (solidcol[first]) 83 + { 84 + if (!(p = memchr(solidcol+first, 0, last-first))) 85 + return; // All solid 86 first = p - solidcol; 87 + } 88 + else 89 + { 90 int to; 91 + if (!(p = memchr(solidcol+first, 1, last-first))) 92 + to = last; 93 + else 94 + to = p - solidcol; 95 R_StoreWallRange(first, to-1); 96 + if (solid) 97 + { 98 memset(solidcol+first,1,to-first); 99 } 100 first = to; ··· 142 ) 143 ) 144 linedef->r_flags = RF_CLOSED; 145 + else 146 + { 147 // Reject empty lines used for triggers 148 // and special events. 149 // Identical floor and ceiling on both sides, ··· 158 sizeof(frontsector->ceiling_xoffs) + sizeof(frontsector->ceiling_yoffs) + 159 sizeof(frontsector->ceilingpic) + sizeof(frontsector->floorpic) + 160 sizeof(frontsector->lightlevel) + sizeof(frontsector->floorlightsec) + 161 + sizeof(frontsector->ceilinglightsec))) 162 + { 163 + linedef->r_flags = 0; 164 + return; 165 + } 166 + else 167 linedef->r_flags = RF_IGNORE; 168 } 169 170 /* cph - I'm too lazy to try and work with offsets in this */ 171 + if (curline->sidedef->rowoffset) 172 + return; 173 174 /* Now decide on texture tiling */ 175 + if (linedef->flags & ML_TWOSIDED) 176 + { 177 int c; 178 179 /* Does top texture need tiling */ ··· 185 if ((c = frontsector->floorheight - backsector->floorheight) > 0 && 186 (textureheight[texturetranslation[curline->sidedef->bottomtexture]] > c)) 187 linedef->r_flags |= RF_BOT_TILE; 188 + } 189 + else 190 + { 191 int c; 192 /* Does middle texture need tiling */ 193 if ((c = frontsector->ceilingheight - frontsector->floorheight) > 0 && ··· 242 tempsec->floor_xoffs = s->floor_xoffs; 243 tempsec->floor_yoffs = s->floor_yoffs; 244 245 + if (underwater) 246 + { 247 + if (s->ceilingpic == skyflatnum) 248 + { 249 tempsec->floorheight = tempsec->ceilingheight+1; 250 tempsec->ceilingpic = tempsec->floorpic; 251 tempsec->ceiling_xoffs = tempsec->floor_xoffs; 252 tempsec->ceiling_yoffs = tempsec->floor_yoffs; 253 + } 254 + else 255 + { 256 tempsec->ceilingpic = s->ceilingpic; 257 tempsec->ceiling_xoffs = s->ceiling_xoffs; 258 tempsec->ceiling_yoffs = s->ceiling_yoffs; ··· 402 403 static const int checkcoord[12][4] = // killough -- static const 404 { 405 + { 406 + 3,0,2,1}, 407 {3,0,2,0}, 408 {3,1,2,0}, 409 {0}, ··· 440 441 // cph - replaced old code, which was unclear and badly commented 442 // Much more efficient code now 443 + if ((signed)angle1 < (signed)angle2) 444 + { /* it's "behind" us */ 445 /* Either angle1 or angle2 is behind us, so it doesn't matter if we 446 * change it to the corect sign 447 */ ··· 451 angle2 = INT_MIN; 452 } 453 454 + if ((signed)angle2 >= (signed)clipangle) 455 + return false; // Both off left edge 456 + if ((signed)angle1 <= -(signed)clipangle) 457 + return false; // Both off right edge 458 + if ((signed)angle1 >= (signed)clipangle) 459 + angle1 = clipangle; // Clip at left edge 460 + if ((signed)angle2 <= -(signed)clipangle) 461 + angle2 = 0-clipangle; // Clip at right edge 462 463 // Find the first clippost 464 // that touches the source post ··· 474 if (sx1 == sx2) 475 return false; 476 477 + if (!memchr(solidcol+sx1, 0, sx2-sx1)) 478 + return false; 479 // All columns it covers are already solidly covered 480 } 481 ··· 502 int ceilinglightlevel; // killough 4/11/98 503 504 #ifdef RANGECHECK 505 + 506 if (num>=numsubsectors) 507 I_Error ("R_Subsector: ss %i with numss = %i", num, numsubsectors); 508 #endif ··· 511 frontsector = sub->sector; 512 count = sub->numlines; 513 line = &segs[sub->firstline]; 514 + // sscount++; 515 516 // killough 3/8/98, 4/4/98: Deep water / fake ceiling effect 517 frontsector = R_FakeFlat(frontsector, &tempsec, &floorlightlevel, ··· 523 524 floorplane = frontsector->floorheight < viewz || // killough 3/7/98 525 (frontsector->heightsec != -1 && 526 + sectors[frontsector->heightsec].ceilingpic == skyflatnum) ? 527 R_FindPlane(frontsector->floorheight, 528 frontsector->floorpic == skyflatnum && // kilough 10/98 529 frontsector->sky & PL_SKYFLAT ? frontsector->sky : ··· 536 ceilingplane = frontsector->ceilingheight > viewz || 537 frontsector->ceilingpic == skyflatnum || 538 (frontsector->heightsec != -1 && 539 + sectors[frontsector->heightsec].floorpic == skyflatnum) ? 540 R_FindPlane(frontsector->ceilingheight, // killough 3/8/98 541 frontsector->ceilingpic == skyflatnum && // kilough 10/98 542 frontsector->sky & PL_SKYFLAT ? frontsector->sky :
+4 -16
apps/plugins/doom/r_bsp.h
··· 29 * 30 *-----------------------------------------------------------------------------*/ 31 32 - 33 #ifndef __R_BSP__ 34 #define __R_BSP__ 35 ··· 48 extern boolean markfloor; /* false if the back side is the same plane */ 49 extern boolean markceiling; 50 51 - //extern boolean skymap; 52 - 53 /* old code -- killough: 54 * extern drawseg_t drawsegs[MAXDRAWSEGS]; 55 * new code -- killough: */ 56 extern drawseg_t *drawsegs; 57 extern unsigned maxdrawsegs; 58 59 - extern drawseg_t* ds_p; 60 - 61 - /*extern lighttable_t** hscalelight; 62 - extern lighttable_t** vscalelight; 63 - extern lighttable_t** dscalelight; 64 - */ 65 - 66 - //typedef void (*drawfunc_t) (int start, int stop); 67 - 68 69 - // BSP? 70 - void R_ClearClipSegs (void); 71 - void R_ClearDrawSegs (void); 72 - void R_RenderBSPNode (int bspnum); 73 int R_DoorClosed(void); /* killough 1/17/98 */ 74 75 /* killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: */
··· 29 * 30 *-----------------------------------------------------------------------------*/ 31 32 #ifndef __R_BSP__ 33 #define __R_BSP__ 34 ··· 47 extern boolean markfloor; /* false if the back side is the same plane */ 48 extern boolean markceiling; 49 50 /* old code -- killough: 51 * extern drawseg_t drawsegs[MAXDRAWSEGS]; 52 * new code -- killough: */ 53 extern drawseg_t *drawsegs; 54 extern unsigned maxdrawsegs; 55 56 + extern drawseg_t *ds_p; 57 58 + void R_ClearClipSegs(void); 59 + void R_ClearDrawSegs(void); 60 + void R_RenderBSPNode(int bspnum); 61 int R_DoorClosed(void); /* killough 1/17/98 */ 62 63 /* killough 4/13/98: fake floors/ceilings for deep water / fake ceilings: */
+82 -69
apps/plugins/doom/r_data.c
··· 63 short patch; 64 short stepdir; // unused in Doom but might be used in Phase 2 Boom 65 short colormap; // unused in Doom but might be used in Phase 2 Boom 66 - } PACKEDATTR mappatch_t; 67 68 typedef struct 69 { ··· 74 char pad[4]; // unused in Doom but might be used in Boom Phase 2 75 short patchcount; 76 mappatch_t patches[1]; 77 - } PACKEDATTR maptexture_t; 78 79 // A maptexturedef_t describes a rectangular texture, which is composed 80 // of one or more mappatch_t structures that arrange graphic patches. ··· 247 248 struct { 249 unsigned short patches, posts; 250 - } *count = calloc(sizeof *count, texture->width); 251 252 { 253 int i = texture->patchcount; ··· 300 { 301 //jff 8/3/98 use logical output routine 302 printf("\nR_GenerateLookup: Column %d is without a patch in texture %s", 303 - x, texture->name); 304 - if (errors) ++*errors; 305 - else I_Error("R_GenerateLookup: Failed"); 306 } 307 if (count[x].patches > 1) // killough 4/9/98 308 { ··· 333 const byte *R_GetColumn(int tex, int col) 334 { 335 const texture_t *texture = textures[tex]; 336 - if (!texture->columnlump) R_GenerateLookup(tex, NULL); 337 { 338 int lump = texture->columnlump[col &= texture->widthmask]; 339 int ofs = texture->columnofs[col]; // cph - WARNING: must be after the above line ··· 345 if ((lump<=0) && (lastlump<=0)) 346 lump = lastlump; // cph - force equal 347 348 - if (lump != lastlump) { 349 // cph - must change the cached lump 350 if (lastlump>0) 351 W_UnlockLumpNum(lastlump); ··· 353 if ((lastlump = lump) > 0) 354 lastlumpdata = W_CacheLumpNum(lump); 355 #ifdef RANGECHECK 356 else 357 lastlumpdata = NULL; 358 #endif 359 } 360 361 if (lump > 0) ··· 533 { 534 //jff 8/3/98 use logical output routine 535 printf("\nR_InitTextures: Missing patch %d in texture %s", 536 - SHORT(mpatch->patch), texture->name); // killough 4/17/98 537 ++errors; 538 } 539 } 540 541 - texture->columnofs = NULL; texture->columnlump = NULL; 542 543 for (j=1; j*2 <= texture->width; j<<=1) 544 ; ··· 687 struct _cache { 688 unsigned char pct; 689 unsigned char playpal[256]; 690 - } cache; 691 692 int tran_filter_pct = 66; // filter percent 693 ··· 712 // Use cached translucency filter if it's available 713 714 if ((cachefd<0) ? cachefd = open(GAMEBASE"tranmap.dat",O_WRONLY | O_CREAT) , 1 : 715 - read(cachefd, &cache, sizeof(cache)) != sizeof(cache) || 716 - cache.pct != tran_filter_pct || 717 - memcmp(cache.playpal, playpal, sizeof cache.playpal) || 718 - read(cachefd, my_tranmap, 256*256) != 256*256 ) // killough 4/11/98 719 { 720 721 long *stackdeath=malloc(256*7*sizeof(long)); // This was a bunch of static varibles, way too big for rockbox ··· 733 if (progress) 734 printf("Please wait: Tranmap build"); 735 // First, convert playpal into long int type, and transpose array, 736 - // for fast inner-loop calculations. Precompute tot array. 737 738 { 739 register int i = 255; ··· 749 d += t*t; 750 p -= 3; 751 tot[i] = d << (TSC-1); 752 - } while (--i>=0); 753 } 754 755 // Next, compute all entries using minimum arithmetic. ··· 775 long best = LONG_MAX; 776 do 777 if ((err = tot[color] - pal[0][color]*r 778 - - pal[1][color]*g - pal[2][color]*b) < best) 779 best = err, *tp = color; 780 - while (--color >= 0); 781 } 782 } 783 } ··· 886 887 void R_PrecacheLevel(void) 888 { 889 - register int i; 890 - register byte *hitlist; 891 892 - if (demoplayback) 893 - return; 894 895 - { 896 - size_t size = numflats > numsprites ? numflats : numsprites; 897 - hitlist = malloc((size_t)numtextures > size ? (unsigned)numtextures : size); 898 - } 899 - // Precache flats. 900 901 - memset(hitlist, 0, numflats); 902 903 - for (i = numsectors; --i >= 0; ) 904 - hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1; 905 906 - for (i = numflats; --i >= 0; ) 907 - if (hitlist[i]) 908 - (W_CacheLumpNum)(firstflat + i, 0); 909 910 - // Precache textures. 911 912 - memset(hitlist, 0, numtextures); 913 914 - for (i = numsides; --i >= 0;) 915 - hitlist[sides[i].bottomtexture] = 916 - hitlist[sides[i].toptexture] = 917 - hitlist[sides[i].midtexture] = 1; 918 919 - // Sky texture is always present. 920 - // Note that F_SKY1 is the name used to 921 - // indicate a sky floor/ceiling as a flat, 922 - // while the sky texture is stored like 923 - // a wall texture, with an episode dependend 924 - // name. 925 926 - hitlist[skytexture] = 1; 927 928 - for (i = numtextures; --i >= 0; ) 929 - if (hitlist[i]) 930 { 931 - texture_t *texture = textures[i]; 932 - int j = texture->patchcount; 933 - while (--j >= 0) 934 - (W_CacheLumpNum)(texture->patches[j].patch, 0); 935 } 936 937 - // Precache sprites. 938 - memset(hitlist, 0, numsprites); 939 940 - { 941 - thinker_t *th; 942 - for (th = thinkercap.next ; th != &thinkercap ; th=th->next) 943 - if (th->function == P_MobjThinker) 944 - hitlist[((mobj_t *)th)->sprite] = 1; 945 - } 946 947 - for (i=numsprites; --i >= 0;) 948 - if (hitlist[i]) 949 { 950 - int j = sprites[i].numframes; 951 - while (--j >= 0) 952 - { 953 short *sflump = sprites[i].spriteframes[j].lump; 954 int k = 7; 955 do 956 - (W_CacheLumpNum)(firstspritelump + sflump[k], 0); 957 while (--k >= 0); 958 - } 959 } 960 - free(hitlist); 961 } 962 963 // Proff - Added for OpenGL
··· 63 short patch; 64 short stepdir; // unused in Doom but might be used in Phase 2 Boom 65 short colormap; // unused in Doom but might be used in Phase 2 Boom 66 + } 67 + PACKEDATTR mappatch_t; 68 69 typedef struct 70 { ··· 75 char pad[4]; // unused in Doom but might be used in Boom Phase 2 76 short patchcount; 77 mappatch_t patches[1]; 78 + } 79 + PACKEDATTR maptexture_t; 80 81 // A maptexturedef_t describes a rectangular texture, which is composed 82 // of one or more mappatch_t structures that arrange graphic patches. ··· 249 250 struct { 251 unsigned short patches, posts; 252 + } 253 + *count = calloc(sizeof *count, texture->width); 254 255 { 256 int i = texture->patchcount; ··· 303 { 304 //jff 8/3/98 use logical output routine 305 printf("\nR_GenerateLookup: Column %d is without a patch in texture %s", 306 + x, texture->name); 307 + if (errors) 308 + ++*errors; 309 + else 310 + I_Error("R_GenerateLookup: Failed"); 311 } 312 if (count[x].patches > 1) // killough 4/9/98 313 { ··· 338 const byte *R_GetColumn(int tex, int col) 339 { 340 const texture_t *texture = textures[tex]; 341 + if (!texture->columnlump) 342 + R_GenerateLookup(tex, NULL); 343 { 344 int lump = texture->columnlump[col &= texture->widthmask]; 345 int ofs = texture->columnofs[col]; // cph - WARNING: must be after the above line ··· 351 if ((lump<=0) && (lastlump<=0)) 352 lump = lastlump; // cph - force equal 353 354 + if (lump != lastlump) 355 + { 356 // cph - must change the cached lump 357 if (lastlump>0) 358 W_UnlockLumpNum(lastlump); ··· 360 if ((lastlump = lump) > 0) 361 lastlumpdata = W_CacheLumpNum(lump); 362 #ifdef RANGECHECK 363 + 364 else 365 lastlumpdata = NULL; 366 #endif 367 + 368 } 369 370 if (lump > 0) ··· 542 { 543 //jff 8/3/98 use logical output routine 544 printf("\nR_InitTextures: Missing patch %d in texture %s", 545 + SHORT(mpatch->patch), texture->name); // killough 4/17/98 546 ++errors; 547 } 548 } 549 550 + texture->columnofs = NULL; 551 + texture->columnlump = NULL; 552 553 for (j=1; j*2 <= texture->width; j<<=1) 554 ; ··· 697 struct _cache { 698 unsigned char pct; 699 unsigned char playpal[256]; 700 + } 701 + cache; 702 703 int tran_filter_pct = 66; // filter percent 704 ··· 723 // Use cached translucency filter if it's available 724 725 if ((cachefd<0) ? cachefd = open(GAMEBASE"tranmap.dat",O_WRONLY | O_CREAT) , 1 : 726 + read(cachefd, &cache, sizeof(cache)) != sizeof(cache) || 727 + cache.pct != tran_filter_pct || 728 + memcmp(cache.playpal, playpal, sizeof cache.playpal) || 729 + read(cachefd, my_tranmap, 256*256) != 256*256 ) // killough 4/11/98 730 { 731 732 long *stackdeath=malloc(256*7*sizeof(long)); // This was a bunch of static varibles, way too big for rockbox ··· 744 if (progress) 745 printf("Please wait: Tranmap build"); 746 // First, convert playpal into long int type, and transpose array, 747 + // for fast inner-loop calculations. Precompute tot array. 748 749 { 750 register int i = 255; ··· 760 d += t*t; 761 p -= 3; 762 tot[i] = d << (TSC-1); 763 + } 764 + while (--i>=0); 765 } 766 767 // Next, compute all entries using minimum arithmetic. ··· 787 long best = LONG_MAX; 788 do 789 if ((err = tot[color] - pal[0][color]*r 790 + - pal[1][color]*g - pal[2][color]*b) < best) 791 best = err, *tp = color; 792 + while (--color >= 0) 793 + ; 794 } 795 } 796 } ··· 899 900 void R_PrecacheLevel(void) 901 { 902 + register int i; 903 + register byte *hitlist; 904 905 + if (demoplayback) 906 + return; 907 908 + { 909 + size_t size = numflats > numsprites ? numflats : numsprites; 910 + hitlist = malloc((size_t)numtextures > size ? (unsigned)numtextures : size); 911 + } 912 + // Precache flats. 913 914 + memset(hitlist, 0, numflats); 915 916 + for (i = numsectors; --i >= 0; ) 917 + hitlist[sectors[i].floorpic] = hitlist[sectors[i].ceilingpic] = 1; 918 919 + for (i = numflats; --i >= 0; ) 920 + if (hitlist[i]) 921 + (W_CacheLumpNum)(firstflat + i, 0); 922 923 + // Precache textures. 924 925 + memset(hitlist, 0, numtextures); 926 927 + for (i = numsides; --i >= 0;) 928 + hitlist[sides[i].bottomtexture] = 929 + hitlist[sides[i].toptexture] = 930 + hitlist[sides[i].midtexture] = 1; 931 932 + // Sky texture is always present. 933 + // Note that F_SKY1 is the name used to 934 + // indicate a sky floor/ceiling as a flat, 935 + // while the sky texture is stored like 936 + // a wall texture, with an episode dependend 937 + // name. 938 939 + hitlist[skytexture] = 1; 940 941 + for (i = numtextures; --i >= 0; ) 942 + if (hitlist[i]) 943 { 944 + texture_t *texture = textures[i]; 945 + int j = texture->patchcount; 946 + while (--j >= 0) 947 + (W_CacheLumpNum)(texture->patches[j].patch, 0); 948 } 949 950 + // Precache sprites. 951 + memset(hitlist, 0, numsprites); 952 953 + { 954 + thinker_t *th; 955 + for (th = thinkercap.next ; th != &thinkercap ; th=th->next) 956 + if (th->function == P_MobjThinker) 957 + hitlist[((mobj_t *)th)->sprite] = 1; 958 + } 959 960 + for (i=numsprites; --i >= 0;) 961 + if (hitlist[i]) 962 { 963 + int j = sprites[i].numframes; 964 + while (--j >= 0) 965 + { 966 short *sflump = sprites[i].spriteframes[j].lump; 967 int k = 7; 968 do 969 + (W_CacheLumpNum)(firstspritelump + sflump[k], 0); 970 while (--k >= 0); 971 + } 972 } 973 + free(hitlist); 974 } 975 976 // Proff - Added for OpenGL
+4 -2
apps/plugins/doom/r_data.h
··· 47 { 48 int originx, originy; // Block origin, which has already accounted 49 int patch; // for the internal origin of the patch. 50 - } texpatch_t; 51 52 // 53 // Texture definition. ··· 69 short width, height; 70 short patchcount; // All the patches[patchcount] are drawn 71 texpatch_t patches[1]; // back-to-front into the cached texture. 72 - } texture_t; 73 74 // Retrieve column data for span blitting. 75 const byte*
··· 47 { 48 int originx, originy; // Block origin, which has already accounted 49 int patch; // for the internal origin of the patch. 50 + } 51 + texpatch_t; 52 53 // 54 // Texture definition. ··· 70 short width, height; 71 short patchcount; // All the patches[patchcount] are drawn 72 texpatch_t patches[1]; // back-to-front into the cached texture. 73 + } 74 + texture_t; 75 76 // Retrieve column data for span blitting. 77 const byte*
+67 -45
apps/plugins/doom/r_defs.h
··· 1 - // Emacs style mode select -*- C++ -*- 2 - //----------------------------------------------------------------------------- 3 - // 4 - // $Id$ 5 - // 6 - // Copyright (C) 1993-1996 by id Software, Inc. 7 - // 8 - // This program is free software; you can redistribute it and/or 9 - // modify it under the terms of the GNU General Public License 10 - // as published by the Free Software Foundation; either version 2 11 - // of the License, or (at your option) any later version. 12 - // 13 - // This program is distributed in the hope that it will be useful, 14 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - // GNU General Public License for more details. 17 - // 18 - // DESCRIPTION: 19 - // Refresh/rendering module, shared data struct definitions. 20 - // 21 - //----------------------------------------------------------------------------- 22 23 #ifndef __R_DEFS__ 24 #define __R_DEFS__ ··· 62 typedef struct 63 { 64 fixed_t x, y; 65 - } vertex_t; 66 - 67 - 68 - // Forward of LineDefs, for Sectors. 69 - struct line_s; 70 71 // Each sector has a degenmobj_t in its center for sound origin purposes. 72 typedef struct 73 { 74 thinker_t thinker; // not used for anything 75 fixed_t x, y, z; 76 - } degenmobj_t; 77 78 // 79 // The SECTORS record, at runtime. ··· 142 short special; 143 short oldspecial; //jff 2/16/98 remembers if sector WAS secret (automap) 144 short tag; 145 - void* specialdata; // ROCKDOOM obsolete 146 - } sector_t; 147 148 // 149 // The SideDef. ··· 164 165 int special; 166 167 - } side_t; 168 169 // 170 // Move clipping aid for LineDefs. ··· 201 RF_IGNORE = 8, // Renderer can skip this line 202 RF_CLOSED =16, // Line blocks view 203 } r_flags; 204 - } line_t; 205 206 // phares 3/14/98 207 // ··· 228 struct msecnode_s *m_sprev; // prev msecnode_t for this sector 229 struct msecnode_s *m_snext; // next msecnode_t for this sector 230 boolean visited; // killough 4/4/98, 4/7/98: used in search algorithms 231 - } msecnode_t; 232 233 // 234 // The LineSeg. ··· 249 // backsector is NULL for one sided lines 250 251 sector_t *frontsector, *backsector; 252 - } seg_t; 253 254 // 255 // A SubSector. ··· 263 { 264 sector_t *sector; 265 unsigned short numlines, firstline; 266 - } subsector_t; 267 268 // 269 // BSP node. ··· 273 fixed_t x, y, dx, dy; // Partition line. 274 fixed_t bbox[2][4]; // Bounding box for each child. 275 unsigned short children[2]; // If NF_SUBSECTOR its a subsector. 276 - } node_t; 277 278 // posts are runs of non masked source pixels 279 typedef struct 280 { 281 byte topdelta; // -1 is the last post in a column 282 byte length; // length data bytes follows 283 - } post_t; 284 285 // column_t is a list of 0 or more post_t, (byte)-1 terminated 286 typedef post_t column_t; ··· 293 // Indeed, true color support is posibble 294 // precalculating 24bpp lightmap/colormap LUT. 295 // from darkening PLAYPAL to all black. 296 - // Could even us emore than 32 levels. 297 typedef byte lighttable_t; 298 299 // ··· 301 // 302 typedef struct drawseg_s 303 { 304 - seg_t* curline; 305 int x1, x2; 306 fixed_t scale1, scale2, scalestep; 307 int silhouette; // 0=none, 1=bottom, 2=top, 3=both ··· 312 // all three adjusted so [x1] is first value. 313 short *sprtopclip, *sprbottomclip, *maskedtexturecol; 314 315 - } drawseg_t; 316 317 // 318 // Patches. ··· 328 short leftoffset; // pixels to the left of origin 329 short topoffset; // pixels below the origin 330 int columnofs[8]; // only [width] used 331 - } patch_t; 332 333 // proff: Added for OpenGL 334 typedef struct ··· 336 int width,height; 337 int leftoffset,topoffset; 338 int lumpnum; 339 - } patchnum_t; 340 341 // 342 // A vissprite_t is a thing that will be drawn during a refresh. ··· 360 361 // killough 3/27/98: height sector for underwater/fake ceiling support 362 int heightsec; 363 - } vissprite_t; 364 365 // 366 // Sprites are patches with a special naming convention ··· 390 // Flip bit (1 = flip) to use for view angles 0-7. 391 byte flip[8]; 392 393 - } spriteframe_t; 394 395 // 396 // A sprite definition: ··· 401 { 402 int numframes; 403 spriteframe_t *spriteframes; 404 - } spritedef_t; 405 406 // 407 // Now what is a visplane, anyway? ··· 417 unsigned short pad2, pad3; // killough 2/8/98, 4/25/98 418 unsigned short bottom[SCREENWIDTH]; 419 unsigned short pad4; 420 - } visplane_t; 421 422 #endif
··· 1 + /* Emacs style mode select -*- C++ -*- 2 + *----------------------------------------------------------------------------- 3 + * 4 + * 5 + * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 + * based on BOOM, a modified and improved DOOM engine 7 + * Copyright (C) 1999 by 8 + * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 + * Copyright (C) 1999-2000 by 10 + * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This program is distributed in the hope that it will be useful, 18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 + * GNU General Public License for more details. 21 + * 22 + * You should have received a copy of the GNU General Public License 23 + * along with this program; if not, write to the Free Software 24 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 + * 02111-1307, USA. 26 + * 27 + * DESCRIPTION: 28 + * Refresh/rendering module, shared data struct definitions. 29 + * 30 + *-----------------------------------------------------------------------------*/ 31 32 #ifndef __R_DEFS__ 33 #define __R_DEFS__ ··· 71 typedef struct 72 { 73 fixed_t x, y; 74 + } 75 + vertex_t; 76 77 // Each sector has a degenmobj_t in its center for sound origin purposes. 78 typedef struct 79 { 80 thinker_t thinker; // not used for anything 81 fixed_t x, y, z; 82 + } 83 + degenmobj_t; 84 85 // 86 // The SECTORS record, at runtime. ··· 149 short special; 150 short oldspecial; //jff 2/16/98 remembers if sector WAS secret (automap) 151 short tag; 152 + } 153 + sector_t; 154 155 // 156 // The SideDef. ··· 171 172 int special; 173 174 + } 175 + side_t; 176 177 // 178 // Move clipping aid for LineDefs. ··· 209 RF_IGNORE = 8, // Renderer can skip this line 210 RF_CLOSED =16, // Line blocks view 211 } r_flags; 212 + } 213 + line_t; 214 215 // phares 3/14/98 216 // ··· 237 struct msecnode_s *m_sprev; // prev msecnode_t for this sector 238 struct msecnode_s *m_snext; // next msecnode_t for this sector 239 boolean visited; // killough 4/4/98, 4/7/98: used in search algorithms 240 + } 241 + msecnode_t; 242 243 // 244 // The LineSeg. ··· 259 // backsector is NULL for one sided lines 260 261 sector_t *frontsector, *backsector; 262 + } 263 + seg_t; 264 265 // 266 // A SubSector. ··· 274 { 275 sector_t *sector; 276 unsigned short numlines, firstline; 277 + } 278 + subsector_t; 279 280 // 281 // BSP node. ··· 285 fixed_t x, y, dx, dy; // Partition line. 286 fixed_t bbox[2][4]; // Bounding box for each child. 287 unsigned short children[2]; // If NF_SUBSECTOR its a subsector. 288 + } 289 + node_t; 290 291 // posts are runs of non masked source pixels 292 typedef struct 293 { 294 byte topdelta; // -1 is the last post in a column 295 byte length; // length data bytes follows 296 + } 297 + post_t; 298 299 // column_t is a list of 0 or more post_t, (byte)-1 terminated 300 typedef post_t column_t; ··· 307 // Indeed, true color support is posibble 308 // precalculating 24bpp lightmap/colormap LUT. 309 // from darkening PLAYPAL to all black. 310 + // Could use even more than 32 levels. 311 + 312 typedef byte lighttable_t; 313 314 // ··· 316 // 317 typedef struct drawseg_s 318 { 319 + seg_t *curline; 320 int x1, x2; 321 fixed_t scale1, scale2, scalestep; 322 int silhouette; // 0=none, 1=bottom, 2=top, 3=both ··· 327 // all three adjusted so [x1] is first value. 328 short *sprtopclip, *sprbottomclip, *maskedtexturecol; 329 330 + } 331 + drawseg_t; 332 333 // 334 // Patches. ··· 344 short leftoffset; // pixels to the left of origin 345 short topoffset; // pixels below the origin 346 int columnofs[8]; // only [width] used 347 + } 348 + patch_t; 349 350 // proff: Added for OpenGL 351 typedef struct ··· 353 int width,height; 354 int leftoffset,topoffset; 355 int lumpnum; 356 + } 357 + patchnum_t; 358 359 // 360 // A vissprite_t is a thing that will be drawn during a refresh. ··· 378 379 // killough 3/27/98: height sector for underwater/fake ceiling support 380 int heightsec; 381 + } 382 + vissprite_t; 383 384 // 385 // Sprites are patches with a special naming convention ··· 409 // Flip bit (1 = flip) to use for view angles 0-7. 410 byte flip[8]; 411 412 + } 413 + spriteframe_t; 414 415 // 416 // A sprite definition: ··· 421 { 422 int numframes; 423 spriteframe_t *spriteframes; 424 + } 425 + spritedef_t; 426 427 // 428 // Now what is a visplane, anyway? ··· 438 unsigned short pad2, pad3; // killough 2/8/98, 4/25/98 439 unsigned short bottom[SCREENWIDTH]; 440 unsigned short pad4; 441 + } 442 + visplane_t; 443 444 #endif
+34 -19
apps/plugins/doom/r_draw.c
··· 41 //#include "lprintf.h" 42 #include "rockmacros.h" 43 44 - #define MAXWIDTH 1120 45 - #define MAXHEIGHT 832 46 - 47 - // status bar height at bottom of screen 48 - #define SBARHEIGHT 32 49 - 50 // 51 // All drawing to the view buffer is accomplished in this file. 52 // The other refresh files only know about ccordinates, ··· 113 return; 114 115 #ifdef RANGECHECK 116 if ((unsigned)dc_x >= SCREENWIDTH 117 - || dc_yl < 0 118 - || dc_yh >= SCREENHEIGHT) 119 I_Error ("R_DrawColumn: %d to %d at %d", dc_yl, dc_yh, dc_x); 120 #endif 121 ··· 127 // Determine scaling, 128 // which is the only mapping to be done. 129 #define fracstep dc_iscale 130 frac = dc_texturemid + (dc_yl-centery)*fracstep; 131 132 // Inner loop that does the actual texture mapping, ··· 135 // 136 // killough 2/1/98: more performance tuning 137 138 - if (dc_texheight == 128) { 139 while(count--) 140 { 141 *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]]; 142 frac += fracstep; 143 dest += SCREENWIDTH; 144 } 145 - } else if (dc_texheight == 0) { 146 /* cph - another special case */ 147 - while (count--) { 148 *dest = dc_colormap[dc_source[frac>>FRACBITS]]; 149 frac += fracstep; 150 dest += SCREENWIDTH; 151 } 152 - } else { 153 register unsigned heightmask = dc_texheight-1; // CPhipps - specify type 154 if (! (dc_texheight & heightmask) ) // power of 2 -- killough 155 { ··· 167 heightmask <<= FRACBITS; 168 169 if (frac < 0) 170 - while ((frac += heightmask) < 0); 171 else 172 while (frac >= (int)heightmask) 173 frac -= heightmask; ··· 215 return; 216 217 #ifdef RANGECHECK 218 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 219 || dc_yl < 0 220 || dc_yh >= SCREENHEIGHT) ··· 227 // Determine scaling, 228 // which is the only mapping to be done. 229 #define fracstep dc_iscale 230 frac = dc_texturemid + (dc_yl-centery)*fracstep; 231 232 // Inner loop that does the actual texture mapping, ··· 245 heightmask <<= FRACBITS; 246 247 if (frac < 0) 248 - while ((frac += heightmask) < 0); 249 else 250 while (frac >= (int)heightmask) 251 frac -= heightmask; ··· 336 return; 337 338 #ifdef RANGECHECK 339 if ((unsigned) dc_x >= (unsigned)SCREENWIDTH 340 || dc_yl < 0 341 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) ··· 377 dest += SCREENWIDTH; 378 379 frac += fracstep; 380 - } while (count--); 381 } 382 383 // ··· 404 return; 405 406 #ifdef RANGECHECK 407 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 408 || dc_yl < 0 409 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) ··· 449 { 450 int i, j; 451 #define MAXTRANS 3 452 byte transtocolour[MAXTRANS]; 453 454 // killough 5/2/98: ··· 457 if (translationtables == NULL) // CPhipps - allow multiple calls 458 translationtables = Z_Malloc(256*MAXTRANS, PU_STATIC, 0); 459 460 - for (i=0; i<MAXTRANS; i++) transtocolour[i] = 255; 461 462 - for (i=0; i<MAXPLAYERS; i++) { 463 byte wantcolour = mapcolor_plyr[i]; 464 playernumtotrans[i] = 0; 465 if (wantcolour != 0x70) // Not green, would like translation 466 for (j=0; j<MAXTRANS; j++) 467 - if (transtocolour[j] == 255) { 468 - transtocolour[j] = wantcolour; playernumtotrans[i] = j+1; break; 469 } 470 } 471
··· 41 //#include "lprintf.h" 42 #include "rockmacros.h" 43 44 // 45 // All drawing to the view buffer is accomplished in this file. 46 // The other refresh files only know about ccordinates, ··· 107 return; 108 109 #ifdef RANGECHECK 110 + 111 if ((unsigned)dc_x >= SCREENWIDTH 112 + || dc_yl < 0 113 + || dc_yh >= SCREENHEIGHT) 114 I_Error ("R_DrawColumn: %d to %d at %d", dc_yl, dc_yh, dc_x); 115 #endif 116 ··· 122 // Determine scaling, 123 // which is the only mapping to be done. 124 #define fracstep dc_iscale 125 + 126 frac = dc_texturemid + (dc_yl-centery)*fracstep; 127 128 // Inner loop that does the actual texture mapping, ··· 131 // 132 // killough 2/1/98: more performance tuning 133 134 + if (dc_texheight == 128) 135 + { 136 while(count--) 137 { 138 *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]]; 139 frac += fracstep; 140 dest += SCREENWIDTH; 141 } 142 + } 143 + else if (dc_texheight == 0) 144 + { 145 /* cph - another special case */ 146 + while (count--) 147 + { 148 *dest = dc_colormap[dc_source[frac>>FRACBITS]]; 149 frac += fracstep; 150 dest += SCREENWIDTH; 151 } 152 + } 153 + else 154 + { 155 register unsigned heightmask = dc_texheight-1; // CPhipps - specify type 156 if (! (dc_texheight & heightmask) ) // power of 2 -- killough 157 { ··· 169 heightmask <<= FRACBITS; 170 171 if (frac < 0) 172 + while ((frac += heightmask) < 0) 173 + ; 174 else 175 while (frac >= (int)heightmask) 176 frac -= heightmask; ··· 218 return; 219 220 #ifdef RANGECHECK 221 + 222 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 223 || dc_yl < 0 224 || dc_yh >= SCREENHEIGHT) ··· 231 // Determine scaling, 232 // which is the only mapping to be done. 233 #define fracstep dc_iscale 234 + 235 frac = dc_texturemid + (dc_yl-centery)*fracstep; 236 237 // Inner loop that does the actual texture mapping, ··· 250 heightmask <<= FRACBITS; 251 252 if (frac < 0) 253 + while ((frac += heightmask) < 0) 254 + ; 255 else 256 while (frac >= (int)heightmask) 257 frac -= heightmask; ··· 342 return; 343 344 #ifdef RANGECHECK 345 + 346 if ((unsigned) dc_x >= (unsigned)SCREENWIDTH 347 || dc_yl < 0 348 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) ··· 384 dest += SCREENWIDTH; 385 386 frac += fracstep; 387 + } 388 + while (count--); 389 } 390 391 // ··· 412 return; 413 414 #ifdef RANGECHECK 415 + 416 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 417 || dc_yl < 0 418 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) ··· 458 { 459 int i, j; 460 #define MAXTRANS 3 461 + 462 byte transtocolour[MAXTRANS]; 463 464 // killough 5/2/98: ··· 467 if (translationtables == NULL) // CPhipps - allow multiple calls 468 translationtables = Z_Malloc(256*MAXTRANS, PU_STATIC, 0); 469 470 + for (i=0; i<MAXTRANS; i++) 471 + transtocolour[i] = 255; 472 473 + for (i=0; i<MAXPLAYERS; i++) 474 + { 475 byte wantcolour = mapcolor_plyr[i]; 476 playernumtotrans[i] = 0; 477 if (wantcolour != 0x70) // Not green, would like translation 478 for (j=0; j<MAXTRANS; j++) 479 + if (transtocolour[j] == 255) 480 + { 481 + transtocolour[j] = wantcolour; 482 + playernumtotrans[i] = j+1; 483 + break; 484 } 485 } 486
+25 -11
apps/plugins/doom/r_main.c
··· 61 int centery IBSS_ATTR; 62 fixed_t centerxfrac, centeryfrac; 63 fixed_t projection; 64 fixed_t viewx, viewy, viewz; 65 angle_t viewangle; 66 fixed_t viewcos, viewsin; ··· 333 scaledviewwidth = SCREENWIDTH; 334 viewheight = SCREENHEIGHT; 335 } 336 else 337 { 338 - scaledviewwidth = setblocks*32; 339 - viewheight = (setblocks*168/10)&~7; 340 } 341 342 viewwidth = scaledviewwidth; ··· 346 centerxfrac = centerx<<FRACBITS; 347 centeryfrac = centery<<FRACBITS; 348 projection = centerxfrac; 349 350 R_InitBuffer (scaledviewwidth, viewheight); 351 352 R_InitTextureMapping(); 353 354 // psprite scales 355 - pspritescale = FRACUNIT*viewwidth/SCREENWIDTH; 356 - pspriteiscale = FRACUNIT*SCREENWIDTH/viewwidth; 357 358 // thing clipping 359 for (i=0 ; i<viewwidth ; i++) ··· 363 for (i=0 ; i<viewheight ; i++) 364 { // killough 5/2/98: reformatted 365 fixed_t dy = D_abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2); 366 - yslope[i] = FixedDiv ( (viewwidth)/2*FRACUNIT, dy); 367 } 368 369 for (i=0 ; i<viewwidth ; i++) ··· 379 int j, startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS; 380 for (j=0 ; j<MAXLIGHTSCALE ; j++) 381 { 382 - // CPhipps - use 320 here instead of SCREENWIDTH, otherwise hires is 383 - // brighter than normal res 384 - int scale = FixedDiv ((320/2*FRACUNIT), (j+1)<<LIGHTZSHIFT); 385 - int t, level = startmap - (scale >>= LIGHTSCALESHIFT)/DISTMAP; 386 387 if (level < 0) 388 level = 0; ··· 410 // CPhipps - R_DrawColumn isn't constant anymore, so must 411 // initialise in code 412 colfunc = R_DrawColumn; // current column draw function 413 - if (SCREENWIDTH<320) 414 - I_Error("R_Init: Screenwidth(%d) < 320",SCREENWIDTH); 415 #if 1 416 printf("\nR_LoadTrigTables: "); 417 R_LoadTrigTables(); 418 #endif 419 printf("\nR_InitData: "); 420 R_InitData(); 421 R_SetViewSize(screenblocks);
··· 61 int centery IBSS_ATTR; 62 fixed_t centerxfrac, centeryfrac; 63 fixed_t projection; 64 + // proff 11/06/98: Added for high-res 65 + fixed_t projectiony; 66 fixed_t viewx, viewy, viewz; 67 angle_t viewangle; 68 fixed_t viewcos, viewsin; ··· 335 scaledviewwidth = SCREENWIDTH; 336 viewheight = SCREENHEIGHT; 337 } 338 + // proff 09/24/98: Added for high-res 339 + else if (setblocks == 10) 340 + { 341 + scaledviewwidth = SCREENWIDTH; 342 + viewheight = SCREENHEIGHT-ST_SCALED_HEIGHT; 343 + } 344 else 345 { 346 + // proff 08/17/98: Changed for high-res 347 + scaledviewwidth = setblocks*SCREENWIDTH/10; 348 + viewheight = (setblocks*(SCREENHEIGHT-ST_SCALED_HEIGHT)/10) & ~7; 349 } 350 351 viewwidth = scaledviewwidth; ··· 355 centerxfrac = centerx<<FRACBITS; 356 centeryfrac = centery<<FRACBITS; 357 projection = centerxfrac; 358 + // proff 11/06/98: Added for high-res 359 + projectiony = ((SCREENHEIGHT * centerx * 320) / 200) / SCREENWIDTH * FRACUNIT; 360 361 R_InitBuffer (scaledviewwidth, viewheight); 362 363 R_InitTextureMapping(); 364 365 // psprite scales 366 + // proff 08/17/98: Changed for high-res 367 + pspritescale = FRACUNIT*viewwidth/320; 368 + pspriteiscale = FRACUNIT*320/viewwidth; 369 + // proff 11/06/98: Added for high-res 370 + pspriteyscale = (((SCREENHEIGHT*viewwidth)/SCREENWIDTH) << FRACBITS) / 200; 371 372 // thing clipping 373 for (i=0 ; i<viewwidth ; i++) ··· 377 for (i=0 ; i<viewheight ; i++) 378 { // killough 5/2/98: reformatted 379 fixed_t dy = D_abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2); 380 + // proff 08/17/98: Changed for high-res 381 + yslope[i] = FixedDiv(projectiony, dy); 382 } 383 384 for (i=0 ; i<viewwidth ; i++) ··· 394 int j, startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS; 395 for (j=0 ; j<MAXLIGHTSCALE ; j++) 396 { 397 + int t, level = startmap - j*320/viewwidth/DISTMAP; 398 399 if (level < 0) 400 level = 0; ··· 422 // CPhipps - R_DrawColumn isn't constant anymore, so must 423 // initialise in code 424 colfunc = R_DrawColumn; // current column draw function 425 + // if (SCREENWIDTH<320) 426 + // I_Error("R_Init: Screenwidth(%d) < 320",SCREENWIDTH); 427 #if 1 428 + 429 printf("\nR_LoadTrigTables: "); 430 R_LoadTrigTables(); 431 #endif 432 + 433 printf("\nR_InitData: "); 434 R_InitData(); 435 R_SetViewSize(screenblocks);
+2
apps/plugins/doom/r_main.h
··· 54 extern fixed_t centerxfrac; 55 extern fixed_t centeryfrac; 56 extern fixed_t projection; 57 extern int validcount; 58 extern int linecount; 59 extern int loopcount;
··· 54 extern fixed_t centerxfrac; 55 extern fixed_t centeryfrac; 56 extern fixed_t projection; 57 + // proff 11/06/98: Added for high-res 58 + extern fixed_t projectiony; 59 extern int validcount; 60 extern int linecount; 61 extern int loopcount;
+14 -6
apps/plugins/doom/r_plane.c
··· 128 unsigned index; 129 130 #ifdef RANGECHECK 131 if (x2 < x1 || x1<0 || x2>=viewwidth || (unsigned)y>(unsigned)viewheight) 132 I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y); 133 #endif ··· 295 for (x=intrl ; x <= intrh && pl->top[x] == 0xffff; x++) 296 ; 297 298 - if (x > intrh) { /* Can use existing plane; extend range */ 299 - pl->minx = unionl; pl->maxx = unionh; 300 return pl; 301 - } else /* Cannot use existing plane; create a new one */ 302 return R_DupPlane(pl,start,stop); 303 } 304 ··· 323 static void R_DoDrawPlane(visplane_t *pl) 324 { 325 register int x; 326 - if (pl->minx <= pl->maxx) { 327 - if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT) { // sky flat 328 int texture; 329 angle_t an, flip; 330 ··· 390 ANGLETOSKYSHIFT); 391 colfunc(); 392 } 393 - } else { // regular flat 394 395 int stop, light; 396
··· 128 unsigned index; 129 130 #ifdef RANGECHECK 131 + 132 if (x2 < x1 || x1<0 || x2>=viewwidth || (unsigned)y>(unsigned)viewheight) 133 I_Error ("R_MapPlane: %i, %i at %i",x1,x2,y); 134 #endif ··· 296 for (x=intrl ; x <= intrh && pl->top[x] == 0xffff; x++) 297 ; 298 299 + if (x > intrh) 300 + { /* Can use existing plane; extend range */ 301 + pl->minx = unionl; 302 + pl->maxx = unionh; 303 return pl; 304 + } 305 + else /* Cannot use existing plane; create a new one */ 306 return R_DupPlane(pl,start,stop); 307 } 308 ··· 327 static void R_DoDrawPlane(visplane_t *pl) 328 { 329 register int x; 330 + if (pl->minx <= pl->maxx) 331 + { 332 + if (pl->picnum == skyflatnum || pl->picnum & PL_SKYFLAT) 333 + { // sky flat 334 int texture; 335 angle_t an, flip; 336 ··· 396 ANGLETOSKYSHIFT); 397 colfunc(); 398 } 399 + } 400 + else 401 + { // regular flat 402 403 int stop, light; 404
+36 -22
apps/plugins/doom/r_segs.c
··· 95 // rw_distance must be calculated first. 96 // 97 // killough 5/2/98: reformatted, cleaned up 98 - static fixed_t R_ScaleFromGlobalAngle (angle_t visangle) 99 { 100 - int anglea = ANG90 + (visangle-viewangle); 101 - int angleb = ANG90 + (visangle-rw_normalangle); 102 - int sinea = finesine[anglea>>ANGLETOFINESHIFT]; 103 - int sineb = finesine[angleb>>ANGLETOFINESHIFT]; 104 - fixed_t num = FixedMul(projection,sineb); 105 - int den = FixedMul(rw_distance,sinea); 106 107 - return den > num>>16 ? (num=FixedDiv (num, den)) > 64*FRACUNIT ? 108 - 64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT ; 109 - } 110 // 111 // R_RenderMaskedSegRange 112 // ··· 146 147 // killough 4/13/98: get correct lightlevel for 2s normal textures 148 lightnum = (R_FakeFlat(frontsector, &tempsec, NULL, NULL, false) 149 - ->lightlevel >> LIGHTSEGSHIFT)+extralight; 150 151 /* cph - ...what is this for? adding contrast to rooms? 152 * It looks crap in outdoor areas */ 153 - if (fake_contrast) { 154 if (curline->v1->y == curline->v2->y) 155 lightnum--; 156 else ··· 402 // cph - if we completely blocked further sight through this column, 403 // add this info to the solid columns array for r_bsp.c 404 if ((markceiling || markfloor) && 405 - (floorclip[rw_x] <= ceilingclip[rw_x] + 1)) { 406 - solidcol[rw_x] = 1; didsolidcol = 1; 407 } 408 409 // save texturecol for backdrawing of masked mid texture ··· 460 461 462 #ifdef RANGECHECK 463 if (start >=viewwidth || start > stop) 464 I_Error ("Bad R_RenderWallRange: %i to %i", start , stop); 465 #endif ··· 574 ds_p->sprtopclip = ds_p->sprbottomclip = NULL; 575 ds_p->silhouette = 0; 576 577 - if (linedef->r_flags & RF_CLOSED) { /* cph - closed 2S line e.g. door */ 578 // cph - killough's (outdated) comment follows - this deals with both 579 // "automap fixes", his and mine 580 // killough 1/17/98: this test is required if the fix ··· 589 ds_p->sprtopclip = screenheightarray; 590 ds_p->tsilheight = INT_MIN; 591 592 - } else { /* not solid - old code */ 593 594 if (frontsector->floorheight > backsector->floorheight) 595 { ··· 721 722 /* cph - ...what is this for? adding contrast to rooms? 723 * It looks crap in outdoor areas */ 724 - if (fake_contrast) { 725 if (curline->v1->y == curline->v2->y) 726 lightnum--; 727 else if (curline->v1->x == curline->v2->x) ··· 778 } 779 780 // render it 781 - if (markceiling) { 782 if (ceilingplane) // killough 4/11/98: add NULL ptr checks 783 ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1); 784 else 785 markceiling = 0; 786 } 787 788 - if (markfloor) { 789 if (floorplane) // killough 4/11/98: add NULL ptr checks 790 /* cph 2003/04/18 - ceilingplane and floorplane might be the same 791 * visplane (e.g. if both skies); R_CheckPlane doesn't know about ··· 805 R_RenderSegLoop(); 806 807 /* cph - if a column was made solid by this wall, we _must_ save full clipping info */ 808 - if (backsector && didsolidcol) { 809 - if (!(ds_p->silhouette & SIL_BOTTOM)) { 810 ds_p->silhouette |= SIL_BOTTOM; 811 ds_p->bsilheight = backsector->floorheight; 812 } 813 - if (!(ds_p->silhouette & SIL_TOP)) { 814 ds_p->silhouette |= SIL_TOP; 815 ds_p->tsilheight = backsector->ceilingheight; 816 }
··· 95 // rw_distance must be calculated first. 96 // 97 // killough 5/2/98: reformatted, cleaned up 98 + // CPhipps - moved here from r_main.c 99 + 100 + static fixed_t R_ScaleFromGlobalAngle(angle_t visangle) 101 { 102 + int anglea = ANG90 + (visangle-viewangle); 103 + int angleb = ANG90 + (visangle-rw_normalangle); 104 + int den = FixedMul(rw_distance, finesine[anglea>>ANGLETOFINESHIFT]); 105 + // proff 11/06/98: Changed for high-res 106 + fixed_t num = FixedMul(projectiony, finesine[angleb>>ANGLETOFINESHIFT]); 107 + return den > num>>16 ? (num = FixedDiv(num, den)) > 64*FRACUNIT ? 108 + 64*FRACUNIT : num < 256 ? 256 : num : 64*FRACUNIT; 109 + } 110 111 // 112 // R_RenderMaskedSegRange 113 // ··· 147 148 // killough 4/13/98: get correct lightlevel for 2s normal textures 149 lightnum = (R_FakeFlat(frontsector, &tempsec, NULL, NULL, false) 150 + ->lightlevel >> LIGHTSEGSHIFT)+extralight; 151 152 /* cph - ...what is this for? adding contrast to rooms? 153 * It looks crap in outdoor areas */ 154 + if (fake_contrast) 155 + { 156 if (curline->v1->y == curline->v2->y) 157 lightnum--; 158 else ··· 404 // cph - if we completely blocked further sight through this column, 405 // add this info to the solid columns array for r_bsp.c 406 if ((markceiling || markfloor) && 407 + (floorclip[rw_x] <= ceilingclip[rw_x] + 1)) 408 + { 409 + solidcol[rw_x] = 1; 410 + didsolidcol = 1; 411 } 412 413 // save texturecol for backdrawing of masked mid texture ··· 464 465 466 #ifdef RANGECHECK 467 + 468 if (start >=viewwidth || start > stop) 469 I_Error ("Bad R_RenderWallRange: %i to %i", start , stop); 470 #endif ··· 579 ds_p->sprtopclip = ds_p->sprbottomclip = NULL; 580 ds_p->silhouette = 0; 581 582 + if (linedef->r_flags & RF_CLOSED) 583 + { /* cph - closed 2S line e.g. door */ 584 // cph - killough's (outdated) comment follows - this deals with both 585 // "automap fixes", his and mine 586 // killough 1/17/98: this test is required if the fix ··· 595 ds_p->sprtopclip = screenheightarray; 596 ds_p->tsilheight = INT_MIN; 597 598 + } 599 + else 600 + { /* not solid - old code */ 601 602 if (frontsector->floorheight > backsector->floorheight) 603 { ··· 729 730 /* cph - ...what is this for? adding contrast to rooms? 731 * It looks crap in outdoor areas */ 732 + if (fake_contrast) 733 + { 734 if (curline->v1->y == curline->v2->y) 735 lightnum--; 736 else if (curline->v1->x == curline->v2->x) ··· 787 } 788 789 // render it 790 + if (markceiling) 791 + { 792 if (ceilingplane) // killough 4/11/98: add NULL ptr checks 793 ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1); 794 else 795 markceiling = 0; 796 } 797 798 + if (markfloor) 799 + { 800 if (floorplane) // killough 4/11/98: add NULL ptr checks 801 /* cph 2003/04/18 - ceilingplane and floorplane might be the same 802 * visplane (e.g. if both skies); R_CheckPlane doesn't know about ··· 816 R_RenderSegLoop(); 817 818 /* cph - if a column was made solid by this wall, we _must_ save full clipping info */ 819 + if (backsector && didsolidcol) 820 + { 821 + if (!(ds_p->silhouette & SIL_BOTTOM)) 822 + { 823 ds_p->silhouette |= SIL_BOTTOM; 824 ds_p->bsilheight = backsector->floorheight; 825 } 826 + if (!(ds_p->silhouette & SIL_TOP)) 827 + { 828 ds_p->silhouette |= SIL_TOP; 829 ds_p->tsilheight = backsector->ceilingheight; 830 }
+137 -118
apps/plugins/doom/r_things.c
··· 52 int column; 53 int topclip; 54 int bottomclip; 55 - } maskdraw_t; 56 57 // 58 // Sprite rotation 0 is facing the viewer, ··· 63 // 64 fixed_t pspritescale; 65 fixed_t pspriteiscale; 66 67 static lighttable_t** spritelights; 68 ··· 95 unsigned rotation, boolean flipped) 96 { 97 98 - if (frame >= MAX_SPRITE_FRAMES || rotation > 8) 99 - I_Error("R_InstallSpriteLump: Bad frame characters in lump %i", lump); 100 101 if ((int)frame > maxframe) 102 maxframe = frame; 103 104 - if (rotation == 0) 105 - { // the lump should be used for all rotations 106 int r; 107 for (r=0 ; r<8 ; r++) 108 - if (sprtemp[frame].lump[r]==-1) 109 - { 110 sprtemp[frame].lump[r] = lump - firstspritelump; 111 sprtemp[frame].flip[r] = (byte) flipped; 112 sprtemp[frame].rotate = false; //jff 4/24/98 if any subbed, rotless 113 - } 114 return; 115 - } 116 117 - // the lump is only used for one rotation 118 119 - if (sprtemp[frame].lump[--rotation] == -1) 120 - { 121 sprtemp[frame].lump[rotation] = lump - firstspritelump; 122 sprtemp[frame].flip[rotation] = (byte) flipped; 123 sprtemp[frame].rotate = true; //jff 4/24/98 only change if rot used 124 - } 125 } 126 127 // ··· 152 153 void R_InitSpriteDefs(const char * const * namelist) 154 { 155 - size_t numentries = lastspritelump-firstspritelump+1; 156 - struct { int index, next; } *hash; 157 - int i; 158 159 - if (!numentries || !*namelist) 160 - return; 161 162 - // count the number of sprite names 163 - for (i=0; namelist[i]; i++) 164 - ; 165 166 - numsprites = i; 167 168 - sprites = Z_Malloc(numsprites *sizeof(*sprites), PU_STATIC, NULL); 169 170 - // Create hash table based on just the first four letters of each sprite 171 - // killough 1/31/98 172 173 - hash = malloc(sizeof(*hash)*numentries); // allocate hash table 174 175 - for (i=0; (size_t)i<numentries; i++) // initialize hash table as empty 176 - hash[i].index = -1; 177 178 - for (i=0; (size_t)i<numentries; i++) // Prepend each sprite to hash chain 179 - { // prepend so that later ones win 180 int j = R_SpriteNameHash(lumpinfo[i+firstspritelump].name) % numentries; 181 hash[i].next = hash[j].index; 182 hash[j].index = i; 183 - } 184 185 - // scan all the lump names for each of the names, 186 - // noting the highest frame letter. 187 188 - for (i=0 ; i<numsprites ; i++) 189 - { 190 const char *spritename = namelist[i]; 191 int j = hash[R_SpriteNameHash(spritename) % numentries].index; 192 193 if (j >= 0) 194 - { 195 - memset(sprtemp, -1, sizeof(sprtemp)); 196 - maxframe = -1; 197 - do 198 - { 199 - register lumpinfo_t *lump = lumpinfo + j + firstspritelump; 200 201 - // Fast portable comparison -- killough 202 - // (using int pointer cast is nonportable): 203 204 - if (!((lump->name[0] ^ spritename[0]) | 205 - (lump->name[1] ^ spritename[1]) | 206 - (lump->name[2] ^ spritename[2]) | 207 - (lump->name[3] ^ spritename[3]))) 208 - { 209 R_InstallSpriteLump(j+firstspritelump, 210 - lump->name[4] - 'A', 211 - lump->name[5] - '0', 212 - false); 213 - if (lump->name[6]) 214 - R_InstallSpriteLump(j+firstspritelump, 215 - lump->name[6] - 'A', 216 - lump->name[7] - '0', 217 - true); 218 - } 219 } 220 - while ((j = hash[j].next) >= 0); 221 222 - // check the frames that were found for completeness 223 - if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98 224 - { 225 - int frame; 226 - for (frame = 0; frame < maxframe; frame++) 227 - switch ((int) sprtemp[frame].rotate) 228 - { 229 - case -1: 230 - // no rotations were found for that frame at all 231 - I_Error ("R_InitSprites: No patches found " 232 - "for %.8s frame %c", namelist[i], frame+'A'); 233 - break; 234 235 - case 0: 236 - // only the first rotation is needed 237 - break; 238 239 - case 1: 240 - // must have all 8 frames 241 - { 242 - int rotation; 243 - for (rotation=0 ; rotation<8 ; rotation++) 244 if (sprtemp[frame].lump[rotation] == -1) 245 - I_Error ("R_InitSprites: Sprite %.8s frame %c " 246 - "is missing rotations", 247 - namelist[i], frame+'A'); 248 - break; 249 - } 250 } 251 - // allocate space for the frames present and copy sprtemp to it 252 - sprites[i].spriteframes = 253 - Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL); 254 - memcpy (sprites[i].spriteframes, sprtemp, 255 - maxframe*sizeof(spriteframe_t)); 256 - } 257 - } 258 - } 259 free(hash); // free hash table 260 } 261 ··· 313 314 void R_DrawMaskedColumn(const column_t *column) 315 { 316 - int topscreen; 317 - int bottomscreen; 318 - fixed_t basetexturemid = dc_texturemid; 319 320 - dc_texheight = 0; // killough 11/98 321 - while (column->topdelta != 0xff) 322 - { 323 // calculate unclipped screen coordinates for post 324 topscreen = sprtopscreen + spryscale*column->topdelta; 325 bottomscreen = topscreen + spryscale*column->length; ··· 328 dc_yh = (bottomscreen-1)>>FRACBITS; 329 330 if (dc_yh >= mfloorclip[dc_x]) 331 - dc_yh = mfloorclip[dc_x]-1; 332 333 if (dc_yl <= mceilingclip[dc_x]) 334 - dc_yl = mceilingclip[dc_x]+1; 335 336 // killough 3/2/98, 3/27/98: Failsafe against overflow/crash: 337 if (dc_yl <= dc_yh && dc_yh < viewheight) 338 - { 339 - dc_source = (byte *)column + 3; 340 - dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS); 341 342 - // Drawn by either R_DrawColumn 343 - // or (SHADOW) R_DrawFuzzColumn. 344 - colfunc (); 345 - } 346 column = (const column_t *)( (byte *)column + column->length + 4); 347 - } 348 - dc_texturemid = basetexturemid; 349 } 350 351 // ··· 384 } 385 else 386 colfunc = R_DrawColumn; // killough 3/14/98, 4/11/98 387 - 388 389 // proff 11/06/98: Changed for high-res 390 - dc_iscale = D_abs(vis->xiscale); 391 dc_texturemid = vis->texturemid; 392 frac = vis->startfrac; 393 spryscale = vis->scale; ··· 398 texturecolumn = frac>>FRACBITS; 399 400 #ifdef RANGECHECK 401 if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width)) 402 I_Error ("R_DrawSpriteRange: Bad texturecolumn"); 403 #endif ··· 428 boolean flip; 429 vissprite_t *vis; 430 #ifndef GL_DOOM 431 fixed_t iscale; 432 #endif 433 int heightsec; // killough 3/27/98 434 435 // transform the origin point ··· 457 458 // decide which patch to use for sprite relative to player 459 #ifdef RANGECHECK 460 if ((unsigned) thing->sprite >= (unsigned)numsprites) 461 I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite); 462 #endif ··· 464 sprdef = &sprites[thing->sprite]; 465 466 #ifdef RANGECHECK 467 if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes) 468 I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite, 469 thing->frame); ··· 538 539 vis->mobjflags = thing->flags; 540 // proff 11/06/98: Changed for high-res 541 - vis->scale = xscale; 542 vis->gx = thing->x; 543 vis->gy = thing->y; 544 vis->gz = thing->z; ··· 634 // decide which patch to use 635 636 #ifdef RANGECHECK 637 if ( (unsigned)psp->state->sprite >= (unsigned)numsprites) 638 I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite); 639 #endif ··· 641 sprdef = &sprites[psp->state->sprite]; 642 643 #ifdef RANGECHECK 644 if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) 645 I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li", 646 psp->state->sprite, psp->state->frame); ··· 677 vis->x1 = x1 < 0 ? 0 : x1; 678 vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; 679 // proff 11/06/98: Added for high-res 680 - vis->scale = pspritescale; 681 682 if (flip) 683 { ··· 760 msort(s2, t, n2); 761 762 while ((*s1)->scale > (*s2)->scale ? 763 - (*d++ = *s1++, --n1) : (*d++ = *s2++, --n2)); 764 765 if (n2) 766 bcopyp(d, s2, n2); ··· 778 if (s[i-1]->scale < temp->scale) 779 { 780 int j = i; 781 - while ((s[j] = s[j-1])->scale < temp->scale && --j); 782 s[j] = temp; 783 } 784 } ··· 893 int phs = viewplayer->mo->subsector->sector->heightsec; 894 if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && 895 (h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 && 896 - (h >>= FRACBITS) < viewheight) { 897 if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) 898 { // clip bottom 899 for (x=spr->x1 ; x<=spr->x2 ; x++) ··· 909 910 if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && 911 (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && 912 - (h >>= FRACBITS) < viewheight) { 913 if (phs != -1 && viewz >= sectors[phs].ceilingheight) 914 { // clip bottom 915 for (x=spr->x1 ; x<=spr->x2 ; x++) ··· 927 // all clipping has been performed, so draw the sprite 928 // check for unclipped columns 929 930 - for (x = spr->x1 ; x<=spr->x2 ; x++) { 931 if (clipbot[x] == -2) 932 clipbot[x] = viewheight; 933 ··· 953 954 // draw all vissprites back to front 955 956 - // rendered_vissprites = num_vissprite; 957 for (i = num_vissprite ;--i>=0; ) 958 R_DrawSprite(vissprite_ptrs[i]); // killough 959
··· 52 int column; 53 int topclip; 54 int bottomclip; 55 + } 56 + maskdraw_t; 57 58 // 59 // Sprite rotation 0 is facing the viewer, ··· 64 // 65 fixed_t pspritescale; 66 fixed_t pspriteiscale; 67 + // proff 11/06/98: Added for high-res 68 + fixed_t pspriteyscale; 69 70 static lighttable_t** spritelights; 71 ··· 98 unsigned rotation, boolean flipped) 99 { 100 101 + if (frame >= MAX_SPRITE_FRAMES || rotation > 8) 102 + I_Error("R_InstallSpriteLump: Bad frame characters in lump %i", lump); 103 104 if ((int)frame > maxframe) 105 maxframe = frame; 106 107 + if (rotation == 0) 108 + { // the lump should be used for all rotations 109 int r; 110 for (r=0 ; r<8 ; r++) 111 + if (sprtemp[frame].lump[r]==-1) 112 + { 113 sprtemp[frame].lump[r] = lump - firstspritelump; 114 sprtemp[frame].flip[r] = (byte) flipped; 115 sprtemp[frame].rotate = false; //jff 4/24/98 if any subbed, rotless 116 + } 117 return; 118 + } 119 120 + // the lump is only used for one rotation 121 122 + if (sprtemp[frame].lump[--rotation] == -1) 123 + { 124 sprtemp[frame].lump[rotation] = lump - firstspritelump; 125 sprtemp[frame].flip[rotation] = (byte) flipped; 126 sprtemp[frame].rotate = true; //jff 4/24/98 only change if rot used 127 + } 128 } 129 130 // ··· 155 156 void R_InitSpriteDefs(const char * const * namelist) 157 { 158 + size_t numentries = lastspritelump-firstspritelump+1; 159 + struct { 160 + int index, next; 161 + } 162 + *hash; 163 + int i; 164 165 + if (!numentries || !*namelist) 166 + return; 167 168 + // count the number of sprite names 169 + for (i=0; namelist[i]; i++) 170 + ; 171 172 + numsprites = i; 173 174 + sprites = Z_Malloc(numsprites *sizeof(*sprites), PU_STATIC, NULL); 175 176 + // Create hash table based on just the first four letters of each sprite 177 + // killough 1/31/98 178 179 + hash = malloc(sizeof(*hash)*numentries); // allocate hash table 180 181 + for (i=0; (size_t)i<numentries; i++) // initialize hash table as empty 182 + hash[i].index = -1; 183 184 + for (i=0; (size_t)i<numentries; i++) // Prepend each sprite to hash chain 185 + { // prepend so that later ones win 186 int j = R_SpriteNameHash(lumpinfo[i+firstspritelump].name) % numentries; 187 hash[i].next = hash[j].index; 188 hash[j].index = i; 189 + } 190 191 + // scan all the lump names for each of the names, 192 + // noting the highest frame letter. 193 194 + for (i=0 ; i<numsprites ; i++) 195 + { 196 const char *spritename = namelist[i]; 197 int j = hash[R_SpriteNameHash(spritename) % numentries].index; 198 199 if (j >= 0) 200 + { 201 + memset(sprtemp, -1, sizeof(sprtemp)); 202 + maxframe = -1; 203 + do 204 + { 205 + register lumpinfo_t *lump = lumpinfo + j + firstspritelump; 206 207 + // Fast portable comparison -- killough 208 + // (using int pointer cast is nonportable): 209 210 + if (!((lump->name[0] ^ spritename[0]) | 211 + (lump->name[1] ^ spritename[1]) | 212 + (lump->name[2] ^ spritename[2]) | 213 + (lump->name[3] ^ spritename[3]))) 214 + { 215 + R_InstallSpriteLump(j+firstspritelump, 216 + lump->name[4] - 'A', 217 + lump->name[5] - '0', 218 + false); 219 + if (lump->name[6]) 220 R_InstallSpriteLump(j+firstspritelump, 221 + lump->name[6] - 'A', 222 + lump->name[7] - '0', 223 + true); 224 } 225 + } 226 + while ((j = hash[j].next) >= 0) 227 + ; 228 229 + // check the frames that were found for completeness 230 + if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98 231 + { 232 + int frame; 233 + for (frame = 0; frame < maxframe; frame++) 234 + switch ((int) sprtemp[frame].rotate) 235 + { 236 + case -1: 237 + // no rotations were found for that frame at all 238 + I_Error ("R_InitSprites: No patches found " 239 + "for %.8s frame %c", namelist[i], frame+'A'); 240 + break; 241 242 + case 0: 243 + // only the first rotation is needed 244 + break; 245 246 + case 1: 247 + // must have all 8 frames 248 + { 249 + int rotation; 250 + for (rotation=0 ; rotation<8 ; rotation++) 251 if (sprtemp[frame].lump[rotation] == -1) 252 + I_Error ("R_InitSprites: Sprite %.8s frame %c " 253 + "is missing rotations", 254 + namelist[i], frame+'A'); 255 + break; 256 } 257 + } 258 + // allocate space for the frames present and copy sprtemp to it 259 + sprites[i].spriteframes = 260 + Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL); 261 + memcpy (sprites[i].spriteframes, sprtemp, 262 + maxframe*sizeof(spriteframe_t)); 263 + } 264 + } 265 + } 266 free(hash); // free hash table 267 } 268 ··· 320 321 void R_DrawMaskedColumn(const column_t *column) 322 { 323 + int topscreen; 324 + int bottomscreen; 325 + fixed_t basetexturemid = dc_texturemid; 326 327 + dc_texheight = 0; // killough 11/98 328 + while (column->topdelta != 0xff) 329 + { 330 // calculate unclipped screen coordinates for post 331 topscreen = sprtopscreen + spryscale*column->topdelta; 332 bottomscreen = topscreen + spryscale*column->length; ··· 335 dc_yh = (bottomscreen-1)>>FRACBITS; 336 337 if (dc_yh >= mfloorclip[dc_x]) 338 + dc_yh = mfloorclip[dc_x]-1; 339 340 if (dc_yl <= mceilingclip[dc_x]) 341 + dc_yl = mceilingclip[dc_x]+1; 342 343 // killough 3/2/98, 3/27/98: Failsafe against overflow/crash: 344 if (dc_yl <= dc_yh && dc_yh < viewheight) 345 + { 346 + dc_source = (byte *)column + 3; 347 + dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS); 348 349 + // Drawn by either R_DrawColumn 350 + // or (SHADOW) R_DrawFuzzColumn. 351 + colfunc (); 352 + } 353 column = (const column_t *)( (byte *)column + column->length + 4); 354 + } 355 + dc_texturemid = basetexturemid; 356 } 357 358 // ··· 391 } 392 else 393 colfunc = R_DrawColumn; // killough 3/14/98, 4/11/98 394 + 395 396 // proff 11/06/98: Changed for high-res 397 + dc_iscale = FixedDiv (FRACUNIT, vis->scale); 398 dc_texturemid = vis->texturemid; 399 frac = vis->startfrac; 400 spryscale = vis->scale; ··· 405 texturecolumn = frac>>FRACBITS; 406 407 #ifdef RANGECHECK 408 + 409 if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width)) 410 I_Error ("R_DrawSpriteRange: Bad texturecolumn"); 411 #endif ··· 436 boolean flip; 437 vissprite_t *vis; 438 #ifndef GL_DOOM 439 + 440 fixed_t iscale; 441 #endif 442 + 443 int heightsec; // killough 3/27/98 444 445 // transform the origin point ··· 467 468 // decide which patch to use for sprite relative to player 469 #ifdef RANGECHECK 470 + 471 if ((unsigned) thing->sprite >= (unsigned)numsprites) 472 I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite); 473 #endif ··· 475 sprdef = &sprites[thing->sprite]; 476 477 #ifdef RANGECHECK 478 + 479 if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes) 480 I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite, 481 thing->frame); ··· 550 551 vis->mobjflags = thing->flags; 552 // proff 11/06/98: Changed for high-res 553 + vis->scale = FixedDiv(projectiony, tz); 554 vis->gx = thing->x; 555 vis->gy = thing->y; 556 vis->gz = thing->z; ··· 646 // decide which patch to use 647 648 #ifdef RANGECHECK 649 + 650 if ( (unsigned)psp->state->sprite >= (unsigned)numsprites) 651 I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite); 652 #endif ··· 654 sprdef = &sprites[psp->state->sprite]; 655 656 #ifdef RANGECHECK 657 + 658 if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) 659 I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li", 660 psp->state->sprite, psp->state->frame); ··· 691 vis->x1 = x1 < 0 ? 0 : x1; 692 vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; 693 // proff 11/06/98: Added for high-res 694 + vis->scale = pspriteyscale; 695 696 if (flip) 697 { ··· 774 msort(s2, t, n2); 775 776 while ((*s1)->scale > (*s2)->scale ? 777 + (*d++ = *s1++, --n1) : (*d++ = *s2++, --n2)) 778 + ; 779 780 if (n2) 781 bcopyp(d, s2, n2); ··· 793 if (s[i-1]->scale < temp->scale) 794 { 795 int j = i; 796 + while ((s[j] = s[j-1])->scale < temp->scale && --j) 797 + ; 798 s[j] = temp; 799 } 800 } ··· 909 int phs = viewplayer->mo->subsector->sector->heightsec; 910 if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && 911 (h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 && 912 + (h >>= FRACBITS) < viewheight) 913 + { 914 if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) 915 { // clip bottom 916 for (x=spr->x1 ; x<=spr->x2 ; x++) ··· 926 927 if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && 928 (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && 929 + (h >>= FRACBITS) < viewheight) 930 + { 931 if (phs != -1 && viewz >= sectors[phs].ceilingheight) 932 { // clip bottom 933 for (x=spr->x1 ; x<=spr->x2 ; x++) ··· 945 // all clipping has been performed, so draw the sprite 946 // check for unclipped columns 947 948 + for (x = spr->x1 ; x<=spr->x2 ; x++) 949 + { 950 if (clipbot[x] == -2) 951 clipbot[x] = viewheight; 952 ··· 972 973 // draw all vissprites back to front 974 975 + // rendered_vissprites = num_vissprite; 976 for (i = num_vissprite ;--i>=0; ) 977 R_DrawSprite(vissprite_ptrs[i]); // killough 978
+49 -63
apps/plugins/doom/r_things.h
··· 1 - // Emacs style mode select -*- C++ -*- 2 - //----------------------------------------------------------------------------- 3 - // 4 - // $Id$ 5 - // 6 - // Copyright (C) 1993-1996 by id Software, Inc. 7 - // 8 - // This program is free software; you can redistribute it and/or 9 - // modify it under the terms of the GNU General Public License 10 - // as published by the Free Software Foundation; either version 2 11 - // of the License, or (at your option) any later version. 12 - // 13 - // This program is distributed in the hope that it will be useful, 14 - // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - // GNU General Public License for more details. 17 - // 18 - // DESCRIPTION: 19 - // Rendering of moving objects, sprites. 20 - // 21 - //----------------------------------------------------------------------------- 22 - 23 24 #ifndef __R_THINGS__ 25 #define __R_THINGS__ 26 - 27 28 #ifdef __GNUG__ 29 #pragma interface 30 #endif 31 32 - #define MAXVISSPRITES 128 33 - /* 34 - extern vissprite_t vissprites[MAXVISSPRITES]; 35 - extern vissprite_t* vissprite_p; 36 - extern vissprite_t vsprsortedhead;*/ 37 - 38 - // Constant arrays used for psprite clipping 39 - // and initializing clipping. 40 - extern short negonearray[SCREENWIDTH]; 41 - extern short screenheightarray[SCREENWIDTH]; 42 - 43 - // vars for R_DrawMaskedColumn 44 - extern short* mfloorclip; 45 - extern short* mceilingclip; 46 - extern fixed_t spryscale; 47 - extern fixed_t sprtopscreen; 48 - 49 - extern fixed_t pspritescale; 50 - extern fixed_t pspriteiscale; 51 52 - 53 - void R_DrawMaskedColumn (const column_t* column); 54 55 56 - void R_SortVisSprites (void); 57 58 void R_AddSprites(subsector_t* subsec, int lightlevel); 59 - void R_AddPSprites (void); 60 - void R_DrawSprites (void); 61 void R_InitSprites(const char * const * namelist); 62 - void R_ClearSprites (void); 63 - void R_DrawMasked (void); 64 - 65 - void 66 - R_ClipVisSprite 67 - ( vissprite_t* vis, 68 - int xl, 69 - int xh ); 70 71 72 #endif 73 - //----------------------------------------------------------------------------- 74 - // 75 - // $Log$ 76 - // Revision 1.1 2006/03/28 15:44:01 dave 77 - // Patch #2969 - Doom! Currently only working on the H300. 78 - // 79 - // 80 - //-----------------------------------------------------------------------------
··· 1 + /* Emacs style mode select -*- C++ -*- 2 + *----------------------------------------------------------------------------- 3 + * 4 + * 5 + * PrBoom a Doom port merged with LxDoom and LSDLDoom 6 + * based on BOOM, a modified and improved DOOM engine 7 + * Copyright (C) 1999 by 8 + * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman 9 + * Copyright (C) 1999-2000 by 10 + * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This program is distributed in the hope that it will be useful, 18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 + * GNU General Public License for more details. 21 + * 22 + * You should have received a copy of the GNU General Public License 23 + * along with this program; if not, write to the Free Software 24 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 25 + * 02111-1307, USA. 26 + * 27 + * DESCRIPTION: 28 + * Rendering of moving objects, sprites. 29 + * 30 + *-----------------------------------------------------------------------------*/ 31 32 #ifndef __R_THINGS__ 33 #define __R_THINGS__ 34 35 #ifdef __GNUG__ 36 #pragma interface 37 #endif 38 39 + /* Constant arrays used for psprite clipping and initializing clipping. */ 40 41 + extern short negonearray[SCREENWIDTH]; 42 + extern short screenheightarray[SCREENWIDTH]; 43 44 + /* Vars for R_DrawMaskedColumn */ 45 46 + extern short *mfloorclip; 47 + extern short *mceilingclip; 48 + extern fixed_t spryscale; 49 + extern fixed_t sprtopscreen; 50 + extern fixed_t pspritescale; 51 + extern fixed_t pspriteiscale; 52 + /* proff 11/06/98: Added for high-res */ 53 + extern fixed_t pspriteyscale; 54 55 + void R_DrawMaskedColumn(const column_t *column); 56 + void R_SortVisSprites(void); 57 void R_AddSprites(subsector_t* subsec, int lightlevel); 58 + void R_AddPSprites(void); 59 + void R_DrawSprites(void); 60 void R_InitSprites(const char * const * namelist); 61 + void R_ClearSprites(void); 62 + void R_DrawMasked(void); 63 64 + void R_ClipVisSprite(vissprite_t *vis, int xl, int xh); 65 66 #endif
+2 -18
apps/plugins/doom/rockdoom.c
··· 176 } 177 /* NOTREACHED */ 178 } 179 - #if 0 180 - static char *tp=NULL; 181 - 182 - if(string!=NULL) 183 - tp=string; 184 - 185 - while(*tp!=NULL) 186 - { 187 - if(*tp==*delimiters) 188 - break; 189 - tp++; 190 - } 191 - *tp=0; 192 - return tp; 193 - } 194 - #endif 195 196 inline void* memcpy(void* dst, const void* src, size_t size) 197 { ··· 415 names[0].string=startpt; 416 names[0].voice_id=0; 417 418 - addons=opendir(GAMEBASE"Addons/"); 419 if(addons==NULL) 420 return 1; 421 ··· 448 names[0].string=startpt; 449 names[0].voice_id=0; 450 451 - demos=opendir(GAMEBASE"Demos/"); 452 if(demos==NULL) 453 return 1; 454
··· 176 } 177 /* NOTREACHED */ 178 } 179 180 inline void* memcpy(void* dst, const void* src, size_t size) 181 { ··· 399 names[0].string=startpt; 400 names[0].voice_id=0; 401 402 + addons=opendir(GAMEBASE"addons/"); 403 if(addons==NULL) 404 return 1; 405 ··· 432 names[0].string=startpt; 433 names[0].voice_id=0; 434 435 + demos=opendir(GAMEBASE"demos/"); 436 if(demos==NULL) 437 return 1; 438
+12 -12
apps/plugins/doom/v_video.c
··· 44 #include "m_swap.h" 45 #include "rockmacros.h" 46 // Each screen is [SCREENWIDTH*SCREENHEIGHT]; 47 - byte *screens[6]; 48 int dirtybox[4]; 49 50 /* jff 4/24/98 initialize this at runtime */ ··· 428 y -= SHORT(patch->topoffset); 429 x -= SHORT(patch->leftoffset); 430 431 - // CPhipps - auto-no-stretch if not high-res 432 - if (flags & VPT_STRETCH) 433 - if ((SCREENWIDTH==320) && (SCREENHEIGHT==200)) 434 - flags &= ~VPT_STRETCH; 435 436 // CPhipps - null translation pointer => no translation 437 if (!trans) 438 flags &= ~VPT_TRANS; 439 440 - if (x<0 441 - ||x+SHORT(patch->width) > ((flags & VPT_STRETCH) ? 320 : SCREENWIDTH) 442 - || y<0 443 - || y+SHORT(patch->height) > ((flags & VPT_STRETCH) ? 200 : SCREENHEIGHT)) 444 - // killough 1/19/98: improved error message: 445 - I_Error("V_DrawMemPatch: Patch (%d,%d)-(%d,%d) exceeds LFB" 446 - "Bad V_DrawMemPatch (flags=%u)", x, y, x+SHORT(patch->width), y+SHORT(patch->height), flags); 447 448 if (!(flags & VPT_STRETCH)) { 449 unsigned int col;
··· 44 #include "m_swap.h" 45 #include "rockmacros.h" 46 // Each screen is [SCREENWIDTH*SCREENHEIGHT]; 47 + byte *screens[6] IBSS_ATTR; 48 int dirtybox[4]; 49 50 /* jff 4/24/98 initialize this at runtime */ ··· 428 y -= SHORT(patch->topoffset); 429 x -= SHORT(patch->leftoffset); 430 431 + // // CPhipps - auto-no-stretch if not high-res 432 + // if (flags & VPT_STRETCH) 433 + // if ((SCREENWIDTH==320) && (SCREENHEIGHT==200)) 434 + // flags &= ~VPT_STRETCH; 435 436 // CPhipps - null translation pointer => no translation 437 if (!trans) 438 flags &= ~VPT_TRANS; 439 440 + // if (x<0 441 + // ||x+SHORT(patch->width) > ((flags & VPT_STRETCH) ? 320 : SCREENWIDTH) 442 + // || y<0 443 + // || y+SHORT(patch->height) > ((flags & VPT_STRETCH) ? 200 : SCREENHEIGHT)) 444 + // // killough 1/19/98: improved error message: 445 + // I_Error("V_DrawMemPatch: Patch (%d,%d)-(%d,%d) exceeds LFB" 446 + // "Bad V_DrawMemPatch (flags=%u)", x, y, x+SHORT(patch->width), y+SHORT(patch->height), flags); 447 448 if (!(flags & VPT_STRETCH)) { 449 unsigned int col;