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