summaryrefslogtreecommitdiff
path: root/apps/plugins/doom/r_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom/r_draw.c')
-rw-r--r--apps/plugins/doom/r_draw.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/apps/plugins/doom/r_draw.c b/apps/plugins/doom/r_draw.c
index df682776cd..f0b9d3300b 100644
--- a/apps/plugins/doom/r_draw.c
+++ b/apps/plugins/doom/r_draw.c
@@ -41,12 +41,6 @@
41//#include "lprintf.h" 41//#include "lprintf.h"
42#include "rockmacros.h" 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// All drawing to the view buffer is accomplished in this file. 45// All drawing to the view buffer is accomplished in this file.
52// The other refresh files only know about ccordinates, 46// The other refresh files only know about ccordinates,
@@ -113,9 +107,10 @@ void R_DrawColumn (void)
113 return; 107 return;
114 108
115#ifdef RANGECHECK 109#ifdef RANGECHECK
110
116 if ((unsigned)dc_x >= SCREENWIDTH 111 if ((unsigned)dc_x >= SCREENWIDTH
117 || dc_yl < 0 112 || dc_yl < 0
118 || dc_yh >= SCREENHEIGHT) 113 || dc_yh >= SCREENHEIGHT)
119 I_Error ("R_DrawColumn: %d to %d at %d", dc_yl, dc_yh, dc_x); 114 I_Error ("R_DrawColumn: %d to %d at %d", dc_yl, dc_yh, dc_x);
120#endif 115#endif
121 116
@@ -127,6 +122,7 @@ void R_DrawColumn (void)
127 // Determine scaling, 122 // Determine scaling,
128 // which is the only mapping to be done. 123 // which is the only mapping to be done.
129#define fracstep dc_iscale 124#define fracstep dc_iscale
125
130 frac = dc_texturemid + (dc_yl-centery)*fracstep; 126 frac = dc_texturemid + (dc_yl-centery)*fracstep;
131 127
132 // Inner loop that does the actual texture mapping, 128 // Inner loop that does the actual texture mapping,
@@ -135,21 +131,27 @@ void R_DrawColumn (void)
135 // 131 //
136 // killough 2/1/98: more performance tuning 132 // killough 2/1/98: more performance tuning
137 133
138 if (dc_texheight == 128) { 134 if (dc_texheight == 128)
135 {
139 while(count--) 136 while(count--)
140 { 137 {
141 *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]]; 138 *dest = dc_colormap[dc_source[(frac>>FRACBITS)&127]];
142 frac += fracstep; 139 frac += fracstep;
143 dest += SCREENWIDTH; 140 dest += SCREENWIDTH;
144 } 141 }
145 } else if (dc_texheight == 0) { 142 }
143 else if (dc_texheight == 0)
144 {
146 /* cph - another special case */ 145 /* cph - another special case */
147 while (count--) { 146 while (count--)
147 {
148 *dest = dc_colormap[dc_source[frac>>FRACBITS]]; 148 *dest = dc_colormap[dc_source[frac>>FRACBITS]];
149 frac += fracstep; 149 frac += fracstep;
150 dest += SCREENWIDTH; 150 dest += SCREENWIDTH;
151 } 151 }
152 } else { 152 }
153 else
154 {
153 register unsigned heightmask = dc_texheight-1; // CPhipps - specify type 155 register unsigned heightmask = dc_texheight-1; // CPhipps - specify type
154 if (! (dc_texheight & heightmask) ) // power of 2 -- killough 156 if (! (dc_texheight & heightmask) ) // power of 2 -- killough
155 { 157 {
@@ -167,7 +169,8 @@ void R_DrawColumn (void)
167 heightmask <<= FRACBITS; 169 heightmask <<= FRACBITS;
168 170
169 if (frac < 0) 171 if (frac < 0)
170 while ((frac += heightmask) < 0); 172 while ((frac += heightmask) < 0)
173 ;
171 else 174 else
172 while (frac >= (int)heightmask) 175 while (frac >= (int)heightmask)
173 frac -= heightmask; 176 frac -= heightmask;
@@ -215,6 +218,7 @@ void R_DrawTLColumn (void)
215 return; 218 return;
216 219
217#ifdef RANGECHECK 220#ifdef RANGECHECK
221
218 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 222 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH
219 || dc_yl < 0 223 || dc_yl < 0
220 || dc_yh >= SCREENHEIGHT) 224 || dc_yh >= SCREENHEIGHT)
@@ -227,6 +231,7 @@ void R_DrawTLColumn (void)
227 // Determine scaling, 231 // Determine scaling,
228 // which is the only mapping to be done. 232 // which is the only mapping to be done.
229#define fracstep dc_iscale 233#define fracstep dc_iscale
234
230 frac = dc_texturemid + (dc_yl-centery)*fracstep; 235 frac = dc_texturemid + (dc_yl-centery)*fracstep;
231 236
232 // Inner loop that does the actual texture mapping, 237 // Inner loop that does the actual texture mapping,
@@ -245,7 +250,8 @@ void R_DrawTLColumn (void)
245 heightmask <<= FRACBITS; 250 heightmask <<= FRACBITS;
246 251
247 if (frac < 0) 252 if (frac < 0)
248 while ((frac += heightmask) < 0); 253 while ((frac += heightmask) < 0)
254 ;
249 else 255 else
250 while (frac >= (int)heightmask) 256 while (frac >= (int)heightmask)
251 frac -= heightmask; 257 frac -= heightmask;
@@ -336,6 +342,7 @@ void R_DrawFuzzColumn(void)
336 return; 342 return;
337 343
338#ifdef RANGECHECK 344#ifdef RANGECHECK
345
339 if ((unsigned) dc_x >= (unsigned)SCREENWIDTH 346 if ((unsigned) dc_x >= (unsigned)SCREENWIDTH
340 || dc_yl < 0 347 || dc_yl < 0
341 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) 348 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT)
@@ -377,7 +384,8 @@ void R_DrawFuzzColumn(void)
377 dest += SCREENWIDTH; 384 dest += SCREENWIDTH;
378 385
379 frac += fracstep; 386 frac += fracstep;
380 } while (count--); 387 }
388 while (count--);
381} 389}
382 390
383// 391//
@@ -404,6 +412,7 @@ void R_DrawTranslatedColumn (void)
404 return; 412 return;
405 413
406#ifdef RANGECHECK 414#ifdef RANGECHECK
415
407 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH 416 if ((unsigned)dc_x >= (unsigned)SCREENWIDTH
408 || dc_yl < 0 417 || dc_yl < 0
409 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT) 418 || (unsigned)dc_yh >= (unsigned)SCREENHEIGHT)
@@ -449,6 +458,7 @@ void R_InitTranslationTables (void)
449{ 458{
450 int i, j; 459 int i, j;
451#define MAXTRANS 3 460#define MAXTRANS 3
461
452 byte transtocolour[MAXTRANS]; 462 byte transtocolour[MAXTRANS];
453 463
454 // killough 5/2/98: 464 // killough 5/2/98:
@@ -457,15 +467,20 @@ void R_InitTranslationTables (void)
457 if (translationtables == NULL) // CPhipps - allow multiple calls 467 if (translationtables == NULL) // CPhipps - allow multiple calls
458 translationtables = Z_Malloc(256*MAXTRANS, PU_STATIC, 0); 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 byte wantcolour = mapcolor_plyr[i]; 475 byte wantcolour = mapcolor_plyr[i];
464 playernumtotrans[i] = 0; 476 playernumtotrans[i] = 0;
465 if (wantcolour != 0x70) // Not green, would like translation 477 if (wantcolour != 0x70) // Not green, would like translation
466 for (j=0; j<MAXTRANS; j++) 478 for (j=0; j<MAXTRANS; j++)
467 if (transtocolour[j] == 255) { 479 if (transtocolour[j] == 255)
468 transtocolour[j] = wantcolour; playernumtotrans[i] = j+1; break; 480 {
481 transtocolour[j] = wantcolour;
482 playernumtotrans[i] = j+1;
483 break;
469 } 484 }
470 } 485 }
471 486