diff options
Diffstat (limited to 'apps/plugins/doom/r_things.c')
-rw-r--r-- | apps/plugins/doom/r_things.c | 259 |
1 files changed, 139 insertions, 120 deletions
diff --git a/apps/plugins/doom/r_things.c b/apps/plugins/doom/r_things.c index 2e1f72e34c..461edadce1 100644 --- a/apps/plugins/doom/r_things.c +++ b/apps/plugins/doom/r_things.c | |||
@@ -52,7 +52,8 @@ typedef struct { | |||
52 | int column; | 52 | int column; |
53 | int topclip; | 53 | int topclip; |
54 | int bottomclip; | 54 | int bottomclip; |
55 | } maskdraw_t; | 55 | } |
56 | maskdraw_t; | ||
56 | 57 | ||
57 | // | 58 | // |
58 | // Sprite rotation 0 is facing the viewer, | 59 | // Sprite rotation 0 is facing the viewer, |
@@ -63,6 +64,8 @@ typedef struct { | |||
63 | // | 64 | // |
64 | fixed_t pspritescale; | 65 | fixed_t pspritescale; |
65 | fixed_t pspriteiscale; | 66 | fixed_t pspriteiscale; |
67 | // proff 11/06/98: Added for high-res | ||
68 | fixed_t pspriteyscale; | ||
66 | 69 | ||
67 | static lighttable_t** spritelights; | 70 | static lighttable_t** spritelights; |
68 | 71 | ||
@@ -95,33 +98,33 @@ static void R_InstallSpriteLump(int lump, unsigned frame, | |||
95 | unsigned rotation, boolean flipped) | 98 | unsigned rotation, boolean flipped) |
96 | { | 99 | { |
97 | 100 | ||
98 | if (frame >= MAX_SPRITE_FRAMES || rotation > 8) | 101 | if (frame >= MAX_SPRITE_FRAMES || rotation > 8) |
99 | I_Error("R_InstallSpriteLump: Bad frame characters in lump %i", lump); | 102 | I_Error("R_InstallSpriteLump: Bad frame characters in lump %i", lump); |
100 | 103 | ||
101 | if ((int)frame > maxframe) | 104 | if ((int)frame > maxframe) |
102 | maxframe = frame; | 105 | maxframe = frame; |
103 | 106 | ||
104 | if (rotation == 0) | 107 | if (rotation == 0) |
105 | { // the lump should be used for all rotations | 108 | { // the lump should be used for all rotations |
106 | int r; | 109 | int r; |
107 | for (r=0 ; r<8 ; r++) | 110 | for (r=0 ; r<8 ; r++) |
108 | if (sprtemp[frame].lump[r]==-1) | 111 | if (sprtemp[frame].lump[r]==-1) |
109 | { | 112 | { |
110 | sprtemp[frame].lump[r] = lump - firstspritelump; | 113 | sprtemp[frame].lump[r] = lump - firstspritelump; |
111 | sprtemp[frame].flip[r] = (byte) flipped; | 114 | sprtemp[frame].flip[r] = (byte) flipped; |
112 | sprtemp[frame].rotate = false; //jff 4/24/98 if any subbed, rotless | 115 | sprtemp[frame].rotate = false; //jff 4/24/98 if any subbed, rotless |
113 | } | 116 | } |
114 | return; | 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) | 122 | if (sprtemp[frame].lump[--rotation] == -1) |
120 | { | 123 | { |
121 | sprtemp[frame].lump[rotation] = lump - firstspritelump; | 124 | sprtemp[frame].lump[rotation] = lump - firstspritelump; |
122 | sprtemp[frame].flip[rotation] = (byte) flipped; | 125 | sprtemp[frame].flip[rotation] = (byte) flipped; |
123 | sprtemp[frame].rotate = true; //jff 4/24/98 only change if rot used | 126 | sprtemp[frame].rotate = true; //jff 4/24/98 only change if rot used |
124 | } | 127 | } |
125 | } | 128 | } |
126 | 129 | ||
127 | // | 130 | // |
@@ -152,110 +155,114 @@ static void R_InstallSpriteLump(int lump, unsigned frame, | |||
152 | 155 | ||
153 | void R_InitSpriteDefs(const char * const * namelist) | 156 | void R_InitSpriteDefs(const char * const * namelist) |
154 | { | 157 | { |
155 | size_t numentries = lastspritelump-firstspritelump+1; | 158 | size_t numentries = lastspritelump-firstspritelump+1; |
156 | struct { int index, next; } *hash; | 159 | struct { |
157 | int i; | 160 | int index, next; |
161 | } | ||
162 | *hash; | ||
163 | int i; | ||
158 | 164 | ||
159 | if (!numentries || !*namelist) | 165 | if (!numentries || !*namelist) |
160 | return; | 166 | return; |
161 | 167 | ||
162 | // count the number of sprite names | 168 | // count the number of sprite names |
163 | for (i=0; namelist[i]; i++) | 169 | for (i=0; namelist[i]; i++) |
164 | ; | 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 | 176 | // Create hash table based on just the first four letters of each sprite |
171 | // killough 1/31/98 | 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 | 181 | for (i=0; (size_t)i<numentries; i++) // initialize hash table as empty |
176 | hash[i].index = -1; | 182 | hash[i].index = -1; |
177 | 183 | ||
178 | for (i=0; (size_t)i<numentries; i++) // Prepend each sprite to hash chain | 184 | for (i=0; (size_t)i<numentries; i++) // Prepend each sprite to hash chain |
179 | { // prepend so that later ones win | 185 | { // prepend so that later ones win |
180 | int j = R_SpriteNameHash(lumpinfo[i+firstspritelump].name) % numentries; | 186 | int j = R_SpriteNameHash(lumpinfo[i+firstspritelump].name) % numentries; |
181 | hash[i].next = hash[j].index; | 187 | hash[i].next = hash[j].index; |
182 | hash[j].index = i; | 188 | hash[j].index = i; |
183 | } | 189 | } |
184 | 190 | ||
185 | // scan all the lump names for each of the names, | 191 | // scan all the lump names for each of the names, |
186 | // noting the highest frame letter. | 192 | // noting the highest frame letter. |
187 | 193 | ||
188 | for (i=0 ; i<numsprites ; i++) | 194 | for (i=0 ; i<numsprites ; i++) |
189 | { | 195 | { |
190 | const char *spritename = namelist[i]; | 196 | const char *spritename = namelist[i]; |
191 | int j = hash[R_SpriteNameHash(spritename) % numentries].index; | 197 | int j = hash[R_SpriteNameHash(spritename) % numentries].index; |
192 | 198 | ||
193 | if (j >= 0) | 199 | if (j >= 0) |
194 | { | 200 | { |
195 | memset(sprtemp, -1, sizeof(sprtemp)); | 201 | memset(sprtemp, -1, sizeof(sprtemp)); |
196 | maxframe = -1; | 202 | maxframe = -1; |
197 | do | 203 | do |
198 | { | 204 | { |
199 | register lumpinfo_t *lump = lumpinfo + j + firstspritelump; | 205 | register lumpinfo_t *lump = lumpinfo + j + firstspritelump; |
200 | 206 | ||
201 | // Fast portable comparison -- killough | 207 | // Fast portable comparison -- killough |
202 | // (using int pointer cast is nonportable): | 208 | // (using int pointer cast is nonportable): |
203 | 209 | ||
204 | if (!((lump->name[0] ^ spritename[0]) | | 210 | if (!((lump->name[0] ^ spritename[0]) | |
205 | (lump->name[1] ^ spritename[1]) | | 211 | (lump->name[1] ^ spritename[1]) | |
206 | (lump->name[2] ^ spritename[2]) | | 212 | (lump->name[2] ^ spritename[2]) | |
207 | (lump->name[3] ^ spritename[3]))) | 213 | (lump->name[3] ^ spritename[3]))) |
208 | { | 214 | { |
215 | R_InstallSpriteLump(j+firstspritelump, | ||
216 | lump->name[4] - 'A', | ||
217 | lump->name[5] - '0', | ||
218 | false); | ||
219 | if (lump->name[6]) | ||
209 | R_InstallSpriteLump(j+firstspritelump, | 220 | R_InstallSpriteLump(j+firstspritelump, |
210 | lump->name[4] - 'A', | 221 | lump->name[6] - 'A', |
211 | lump->name[5] - '0', | 222 | lump->name[7] - '0', |
212 | false); | 223 | true); |
213 | if (lump->name[6]) | ||
214 | R_InstallSpriteLump(j+firstspritelump, | ||
215 | lump->name[6] - 'A', | ||
216 | lump->name[7] - '0', | ||
217 | true); | ||
218 | } | ||
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 | 229 | // check the frames that were found for completeness |
223 | if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98 | 230 | if ((sprites[i].numframes = ++maxframe)) // killough 1/31/98 |
224 | { | 231 | { |
225 | int frame; | 232 | int frame; |
226 | for (frame = 0; frame < maxframe; frame++) | 233 | for (frame = 0; frame < maxframe; frame++) |
227 | switch ((int) sprtemp[frame].rotate) | 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 | ||
228 | { | 248 | { |
229 | case -1: | 249 | int rotation; |
230 | // no rotations were found for that frame at all | 250 | for (rotation=0 ; rotation<8 ; rotation++) |
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) | 251 | if (sprtemp[frame].lump[rotation] == -1) |
245 | I_Error ("R_InitSprites: Sprite %.8s frame %c " | 252 | I_Error ("R_InitSprites: Sprite %.8s frame %c " |
246 | "is missing rotations", | 253 | "is missing rotations", |
247 | namelist[i], frame+'A'); | 254 | namelist[i], frame+'A'); |
248 | break; | 255 | break; |
249 | } | ||
250 | } | 256 | } |
251 | // allocate space for the frames present and copy sprtemp to it | 257 | } |
252 | sprites[i].spriteframes = | 258 | // allocate space for the frames present and copy sprtemp to it |
253 | Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL); | 259 | sprites[i].spriteframes = |
254 | memcpy (sprites[i].spriteframes, sprtemp, | 260 | Z_Malloc (maxframe * sizeof(spriteframe_t), PU_STATIC, NULL); |
255 | maxframe*sizeof(spriteframe_t)); | 261 | memcpy (sprites[i].spriteframes, sprtemp, |
256 | } | 262 | maxframe*sizeof(spriteframe_t)); |
257 | } | 263 | } |
258 | } | 264 | } |
265 | } | ||
259 | free(hash); // free hash table | 266 | free(hash); // free hash table |
260 | } | 267 | } |
261 | 268 | ||
@@ -313,13 +320,13 @@ fixed_t sprtopscreen; | |||
313 | 320 | ||
314 | void R_DrawMaskedColumn(const column_t *column) | 321 | void R_DrawMaskedColumn(const column_t *column) |
315 | { | 322 | { |
316 | int topscreen; | 323 | int topscreen; |
317 | int bottomscreen; | 324 | int bottomscreen; |
318 | fixed_t basetexturemid = dc_texturemid; | 325 | fixed_t basetexturemid = dc_texturemid; |
319 | 326 | ||
320 | dc_texheight = 0; // killough 11/98 | 327 | dc_texheight = 0; // killough 11/98 |
321 | while (column->topdelta != 0xff) | 328 | while (column->topdelta != 0xff) |
322 | { | 329 | { |
323 | // calculate unclipped screen coordinates for post | 330 | // calculate unclipped screen coordinates for post |
324 | topscreen = sprtopscreen + spryscale*column->topdelta; | 331 | topscreen = sprtopscreen + spryscale*column->topdelta; |
325 | bottomscreen = topscreen + spryscale*column->length; | 332 | bottomscreen = topscreen + spryscale*column->length; |
@@ -328,24 +335,24 @@ void R_DrawMaskedColumn(const column_t *column) | |||
328 | dc_yh = (bottomscreen-1)>>FRACBITS; | 335 | dc_yh = (bottomscreen-1)>>FRACBITS; |
329 | 336 | ||
330 | if (dc_yh >= mfloorclip[dc_x]) | 337 | if (dc_yh >= mfloorclip[dc_x]) |
331 | dc_yh = mfloorclip[dc_x]-1; | 338 | dc_yh = mfloorclip[dc_x]-1; |
332 | 339 | ||
333 | if (dc_yl <= mceilingclip[dc_x]) | 340 | if (dc_yl <= mceilingclip[dc_x]) |
334 | dc_yl = mceilingclip[dc_x]+1; | 341 | dc_yl = mceilingclip[dc_x]+1; |
335 | 342 | ||
336 | // killough 3/2/98, 3/27/98: Failsafe against overflow/crash: | 343 | // killough 3/2/98, 3/27/98: Failsafe against overflow/crash: |
337 | if (dc_yl <= dc_yh && dc_yh < viewheight) | 344 | if (dc_yl <= dc_yh && dc_yh < viewheight) |
338 | { | 345 | { |
339 | dc_source = (byte *)column + 3; | 346 | dc_source = (byte *)column + 3; |
340 | dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS); | 347 | dc_texturemid = basetexturemid - (column->topdelta<<FRACBITS); |
341 | 348 | ||
342 | // Drawn by either R_DrawColumn | 349 | // Drawn by either R_DrawColumn |
343 | // or (SHADOW) R_DrawFuzzColumn. | 350 | // or (SHADOW) R_DrawFuzzColumn. |
344 | colfunc (); | 351 | colfunc (); |
345 | } | 352 | } |
346 | column = (const column_t *)( (byte *)column + column->length + 4); | 353 | column = (const column_t *)( (byte *)column + column->length + 4); |
347 | } | 354 | } |
348 | dc_texturemid = basetexturemid; | 355 | dc_texturemid = basetexturemid; |
349 | } | 356 | } |
350 | 357 | ||
351 | // | 358 | // |
@@ -384,10 +391,10 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2) | |||
384 | } | 391 | } |
385 | else | 392 | else |
386 | colfunc = R_DrawColumn; // killough 3/14/98, 4/11/98 | 393 | colfunc = R_DrawColumn; // killough 3/14/98, 4/11/98 |
387 | 394 | ||
388 | 395 | ||
389 | // proff 11/06/98: Changed for high-res | 396 | // proff 11/06/98: Changed for high-res |
390 | dc_iscale = D_abs(vis->xiscale); | 397 | dc_iscale = FixedDiv (FRACUNIT, vis->scale); |
391 | dc_texturemid = vis->texturemid; | 398 | dc_texturemid = vis->texturemid; |
392 | frac = vis->startfrac; | 399 | frac = vis->startfrac; |
393 | spryscale = vis->scale; | 400 | spryscale = vis->scale; |
@@ -398,6 +405,7 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2) | |||
398 | texturecolumn = frac>>FRACBITS; | 405 | texturecolumn = frac>>FRACBITS; |
399 | 406 | ||
400 | #ifdef RANGECHECK | 407 | #ifdef RANGECHECK |
408 | |||
401 | if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width)) | 409 | if (texturecolumn < 0 || texturecolumn >= SHORT(patch->width)) |
402 | I_Error ("R_DrawSpriteRange: Bad texturecolumn"); | 410 | I_Error ("R_DrawSpriteRange: Bad texturecolumn"); |
403 | #endif | 411 | #endif |
@@ -428,8 +436,10 @@ void R_ProjectSprite (mobj_t* thing) | |||
428 | boolean flip; | 436 | boolean flip; |
429 | vissprite_t *vis; | 437 | vissprite_t *vis; |
430 | #ifndef GL_DOOM | 438 | #ifndef GL_DOOM |
439 | |||
431 | fixed_t iscale; | 440 | fixed_t iscale; |
432 | #endif | 441 | #endif |
442 | |||
433 | int heightsec; // killough 3/27/98 | 443 | int heightsec; // killough 3/27/98 |
434 | 444 | ||
435 | // transform the origin point | 445 | // transform the origin point |
@@ -457,6 +467,7 @@ void R_ProjectSprite (mobj_t* thing) | |||
457 | 467 | ||
458 | // decide which patch to use for sprite relative to player | 468 | // decide which patch to use for sprite relative to player |
459 | #ifdef RANGECHECK | 469 | #ifdef RANGECHECK |
470 | |||
460 | if ((unsigned) thing->sprite >= (unsigned)numsprites) | 471 | if ((unsigned) thing->sprite >= (unsigned)numsprites) |
461 | I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite); | 472 | I_Error ("R_ProjectSprite: Invalid sprite number %i", thing->sprite); |
462 | #endif | 473 | #endif |
@@ -464,6 +475,7 @@ void R_ProjectSprite (mobj_t* thing) | |||
464 | sprdef = &sprites[thing->sprite]; | 475 | sprdef = &sprites[thing->sprite]; |
465 | 476 | ||
466 | #ifdef RANGECHECK | 477 | #ifdef RANGECHECK |
478 | |||
467 | if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes) | 479 | if ((thing->frame&FF_FRAMEMASK) >= sprdef->numframes) |
468 | I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite, | 480 | I_Error ("R_ProjectSprite: Invalid sprite frame %i : %i", thing->sprite, |
469 | thing->frame); | 481 | thing->frame); |
@@ -538,7 +550,7 @@ void R_ProjectSprite (mobj_t* thing) | |||
538 | 550 | ||
539 | vis->mobjflags = thing->flags; | 551 | vis->mobjflags = thing->flags; |
540 | // proff 11/06/98: Changed for high-res | 552 | // proff 11/06/98: Changed for high-res |
541 | vis->scale = xscale; | 553 | vis->scale = FixedDiv(projectiony, tz); |
542 | vis->gx = thing->x; | 554 | vis->gx = thing->x; |
543 | vis->gy = thing->y; | 555 | vis->gy = thing->y; |
544 | vis->gz = thing->z; | 556 | vis->gz = thing->z; |
@@ -634,6 +646,7 @@ void R_DrawPSprite (pspdef_t *psp) | |||
634 | // decide which patch to use | 646 | // decide which patch to use |
635 | 647 | ||
636 | #ifdef RANGECHECK | 648 | #ifdef RANGECHECK |
649 | |||
637 | if ( (unsigned)psp->state->sprite >= (unsigned)numsprites) | 650 | if ( (unsigned)psp->state->sprite >= (unsigned)numsprites) |
638 | I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite); | 651 | I_Error ("R_ProjectSprite: Invalid sprite number %i", psp->state->sprite); |
639 | #endif | 652 | #endif |
@@ -641,6 +654,7 @@ void R_DrawPSprite (pspdef_t *psp) | |||
641 | sprdef = &sprites[psp->state->sprite]; | 654 | sprdef = &sprites[psp->state->sprite]; |
642 | 655 | ||
643 | #ifdef RANGECHECK | 656 | #ifdef RANGECHECK |
657 | |||
644 | if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) | 658 | if ( (psp->state->frame & FF_FRAMEMASK) >= sprdef->numframes) |
645 | I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li", | 659 | I_Error ("R_ProjectSprite: Invalid sprite frame %i : %li", |
646 | psp->state->sprite, psp->state->frame); | 660 | psp->state->sprite, psp->state->frame); |
@@ -677,7 +691,7 @@ void R_DrawPSprite (pspdef_t *psp) | |||
677 | vis->x1 = x1 < 0 ? 0 : x1; | 691 | vis->x1 = x1 < 0 ? 0 : x1; |
678 | vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; | 692 | vis->x2 = x2 >= viewwidth ? viewwidth-1 : x2; |
679 | // proff 11/06/98: Added for high-res | 693 | // proff 11/06/98: Added for high-res |
680 | vis->scale = pspritescale; | 694 | vis->scale = pspriteyscale; |
681 | 695 | ||
682 | if (flip) | 696 | if (flip) |
683 | { | 697 | { |
@@ -760,7 +774,8 @@ static void msort(vissprite_t **s, vissprite_t **t, int n) | |||
760 | msort(s2, t, n2); | 774 | msort(s2, t, n2); |
761 | 775 | ||
762 | while ((*s1)->scale > (*s2)->scale ? | 776 | while ((*s1)->scale > (*s2)->scale ? |
763 | (*d++ = *s1++, --n1) : (*d++ = *s2++, --n2)); | 777 | (*d++ = *s1++, --n1) : (*d++ = *s2++, --n2)) |
778 | ; | ||
764 | 779 | ||
765 | if (n2) | 780 | if (n2) |
766 | bcopyp(d, s2, n2); | 781 | bcopyp(d, s2, n2); |
@@ -778,7 +793,8 @@ static void msort(vissprite_t **s, vissprite_t **t, int n) | |||
778 | if (s[i-1]->scale < temp->scale) | 793 | if (s[i-1]->scale < temp->scale) |
779 | { | 794 | { |
780 | int j = i; | 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 | s[j] = temp; | 798 | s[j] = temp; |
783 | } | 799 | } |
784 | } | 800 | } |
@@ -893,7 +909,8 @@ void R_DrawSprite (vissprite_t* spr) | |||
893 | int phs = viewplayer->mo->subsector->sector->heightsec; | 909 | int phs = viewplayer->mo->subsector->sector->heightsec; |
894 | if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && | 910 | if ((mh = sectors[spr->heightsec].floorheight) > spr->gz && |
895 | (h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 && | 911 | (h = centeryfrac - FixedMul(mh-=viewz, spr->scale)) >= 0 && |
896 | (h >>= FRACBITS) < viewheight) { | 912 | (h >>= FRACBITS) < viewheight) |
913 | { | ||
897 | if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) | 914 | if (mh <= 0 || (phs != -1 && viewz > sectors[phs].floorheight)) |
898 | { // clip bottom | 915 | { // clip bottom |
899 | for (x=spr->x1 ; x<=spr->x2 ; x++) | 916 | for (x=spr->x1 ; x<=spr->x2 ; x++) |
@@ -909,7 +926,8 @@ void R_DrawSprite (vissprite_t* spr) | |||
909 | 926 | ||
910 | if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && | 927 | if ((mh = sectors[spr->heightsec].ceilingheight) < spr->gzt && |
911 | (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && | 928 | (h = centeryfrac - FixedMul(mh-viewz, spr->scale)) >= 0 && |
912 | (h >>= FRACBITS) < viewheight) { | 929 | (h >>= FRACBITS) < viewheight) |
930 | { | ||
913 | if (phs != -1 && viewz >= sectors[phs].ceilingheight) | 931 | if (phs != -1 && viewz >= sectors[phs].ceilingheight) |
914 | { // clip bottom | 932 | { // clip bottom |
915 | for (x=spr->x1 ; x<=spr->x2 ; x++) | 933 | for (x=spr->x1 ; x<=spr->x2 ; x++) |
@@ -927,7 +945,8 @@ void R_DrawSprite (vissprite_t* spr) | |||
927 | // all clipping has been performed, so draw the sprite | 945 | // all clipping has been performed, so draw the sprite |
928 | // check for unclipped columns | 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 | if (clipbot[x] == -2) | 950 | if (clipbot[x] == -2) |
932 | clipbot[x] = viewheight; | 951 | clipbot[x] = viewheight; |
933 | 952 | ||
@@ -953,7 +972,7 @@ void R_DrawMasked(void) | |||
953 | 972 | ||
954 | // draw all vissprites back to front | 973 | // draw all vissprites back to front |
955 | 974 | ||
956 | // rendered_vissprites = num_vissprite; | 975 | // rendered_vissprites = num_vissprite; |
957 | for (i = num_vissprite ;--i>=0; ) | 976 | for (i = num_vissprite ;--i>=0; ) |
958 | R_DrawSprite(vissprite_ptrs[i]); // killough | 977 | R_DrawSprite(vissprite_ptrs[i]); // killough |
959 | 978 | ||