Subversion Repositories eduke32

Rev

Rev 5056 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5056 Rev 5072
Line 1395... Line 1395...
1395
1395
1396
}
1396
}
1397
1397
1398
void                polymer_drawmaskwall(int32_t damaskwallcnt)
1398
void                polymer_drawmaskwall(int32_t damaskwallcnt)
1399
{
1399
{
1400
    sectortype      *sec;
1400
    tsectortype     *sec;
1401
    walltype        *wal;
1401
    walltype        *wal;
1402
    _prwall         *w;
1402
    _prwall         *w;
1403
    GLubyte         oldcolor[4];
1403
    GLubyte         oldcolor[4];
1404
1404
1405
    if (pr_verbosity >= 3) OSD_Printf("PR : Masked wall %i...\n", damaskwallcnt);
1405
    if (pr_verbosity >= 3) OSD_Printf("PR : Masked wall %i...\n", damaskwallcnt);
1406
1406
1407
    sec = &sector[sectorofwall(maskwall[damaskwallcnt])];
1407
    sec = (tsectortype *)&sector[sectorofwall(maskwall[damaskwallcnt])];
1408
    wal = &wall[maskwall[damaskwallcnt]];
1408
    wal = &wall[maskwall[damaskwallcnt]];
1409
    w = prwalls[maskwall[damaskwallcnt]];
1409
    w = prwalls[maskwall[damaskwallcnt]];
1410
1410
1411
    bglEnable(GL_CULL_FACE);
1411
    bglEnable(GL_CULL_FACE);
1412
1412
Line 1424... Line 1424...
1424
{
1424
{
1425
    int32_t         i, j, cs;
1425
    int32_t         i, j, cs;
1426
    _prsprite       *s;
1426
    _prsprite       *s;
1427
1427
1428
    tspritetype      *const tspr = tspriteptr[snum];
1428
    tspritetype      *const tspr = tspriteptr[snum];
1429
    const sectortype *sec;
1429
    const tsectortype *sec;
1430
1430
1431
    if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum);
1431
    if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum);
1432
1432
1433
    if (bad_tspr(tspr))
1433
    if (bad_tspr(tspr))
1434
        return;
1434
        return;
Line 1439... Line 1439...
1439
    if ((tspr->cstat & 16384) && (!depth || mirrors[depth-1].plane))
1439
    if ((tspr->cstat & 16384) && (!depth || mirrors[depth-1].plane))
1440
        return;
1440
        return;
1441
1441
1442
    DO_TILE_ANIM(tspr->picnum, tspr->owner+32768);
1442
    DO_TILE_ANIM(tspr->picnum, tspr->owner+32768);
1443
1443
1444
    sec = &sector[tspr->sectnum];
1444
    sec = (tsectortype *)&sector[tspr->sectnum];
1445
    calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, tspr->shade), sec->visibility,
1445
    calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, tspr->shade), sec->visibility,
1446
                       get_floor_fogpal(&sector[tspr->sectnum]));
1446
                       get_floor_fogpal((tsectortype *)&sector[tspr->sectnum]));
1447
1447
1448
    if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 &&
1448
    if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 &&
1449
        tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 &&
1449
        tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 &&
1450
        !(spriteext[tspr->owner].flags & SPREXT_NOTMD))
1450
        !(spriteext[tspr->owner].flags & SPREXT_NOTMD))
1451
    {
1451
    {
Line 1692... Line 1692...
1692
1692
1693
1693
1694
// CORE
1694
// CORE
1695
static void         polymer_displayrooms(const int16_t dacursectnum)
1695
static void         polymer_displayrooms(const int16_t dacursectnum)
1696
{
1696
{
1697
    sectortype      *sec;
1697
    tsectortype      *sec;
1698
    int32_t         i;
1698
    int32_t         i;
1699
    int16_t         bunchnum;
1699
    int16_t         bunchnum;
1700
    int16_t         ns;
1700
    int16_t         ns;
1701
    GLint           result;
1701
    GLint           result;
1702
    int16_t         doquery;
1702
    int16_t         doquery;
Line 1750... Line 1750...
1750
    // depth-only occlusion testing pass
1750
    // depth-only occlusion testing pass
1751
//     overridematerial = 0;
1751
//     overridematerial = 0;
1752
1752
1753
    while (front != back)
1753
    while (front != back)
1754
    {
1754
    {
1755
        sec = &sector[sectorqueue[front]];
1755
        sec = (tsectortype *)&sector[sectorqueue[front]];
1756
1756
1757
        polymer_pokesector(sectorqueue[front]);
1757
        polymer_pokesector(sectorqueue[front]);
1758
        polymer_drawsector(sectorqueue[front], FALSE);
1758
        polymer_drawsector(sectorqueue[front], FALSE);
1759
        polymer_scansprites(sectorqueue[front], localtsprite, &localspritesortcnt);
1759
        polymer_scansprites(sectorqueue[front], localtsprite, &localspritesortcnt);
1760
1760
Line 2296... Line 2296...
2296
}
2296
}
2297
2297
2298
// SECTORS
2298
// SECTORS
2299
static int32_t      polymer_initsector(int16_t sectnum)
2299
static int32_t      polymer_initsector(int16_t sectnum)
2300
{
2300
{
2301
    sectortype      *sec;
2301
    tsectortype      *sec;
2302
    _prsector*      s;
2302
    _prsector*      s;
2303
2303
2304
    if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum);
2304
    if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum);
2305
2305
2306
    sec = &sector[sectnum];
2306
    sec = (tsectortype *)&sector[sectnum];
2307
    s = (_prsector *)Xcalloc(1, sizeof(_prsector));
2307
    s = (_prsector *)Xcalloc(1, sizeof(_prsector));
2308
2308
2309
    s->verts = (GLdouble *)Xcalloc(sec->wallnum, sizeof(GLdouble) * 3);
2309
    s->verts = (GLdouble *)Xcalloc(sec->wallnum, sizeof(GLdouble) * 3);
2310
    s->floor.buffer = (GLfloat *)Xcalloc(sec->wallnum, sizeof(GLfloat) * 5);
2310
    s->floor.buffer = (GLfloat *)Xcalloc(sec->wallnum, sizeof(GLfloat) * 5);
2311
    s->floor.vertcount = sec->wallnum;
2311
    s->floor.vertcount = sec->wallnum;
Line 2335... Line 2335...
2335
}
2335
}
2336
2336
2337
static int32_t      polymer_updatesector(int16_t sectnum)
2337
static int32_t      polymer_updatesector(int16_t sectnum)
2338
{
2338
{
2339
    _prsector*      s;
2339
    _prsector*      s;
2340
    sectortype      *sec;
2340
    tsectortype      *sec;
2341
    walltype        *wal;
2341
    walltype        *wal;
2342
    int32_t         i, j;
2342
    int32_t         i, j;
2343
    int32_t         ceilz, florz;
2343
    int32_t         ceilz, florz;
2344
    int32_t         tex, tey, heidiff;
2344
    int32_t         tex, tey, heidiff;
2345
    float           secangcos, secangsin, scalecoef, xpancoef, ypancoef;
2345
    float           secangcos, secangsin, scalecoef, xpancoef, ypancoef;
Line 2347... Line 2347...
2347
    int16_t         curstat, curpicnum, floorpicnum, ceilingpicnum;
2347
    int16_t         curstat, curpicnum, floorpicnum, ceilingpicnum;
2348
    char            curxpanning, curypanning;
2348
    char            curxpanning, curypanning;
2349
    GLfloat*        curbuffer;
2349
    GLfloat*        curbuffer;
2350
2350
2351
    s = prsectors[sectnum];
2351
    s = prsectors[sectnum];
2352
    sec = &sector[sectnum];
2352
    sec = (tsectortype *)&sector[sectnum];
2353
2353
2354
    secangcos = secangsin = 2;
2354
    secangcos = secangsin = 2;
2355
2355
2356
    if (s == NULL)
2356
    if (s == NULL)
2357
    {
2357
    {
Line 2633... Line 2633...
2633
2633
2634
static int32_t      polymer_buildfloor(int16_t sectnum)
2634
static int32_t      polymer_buildfloor(int16_t sectnum)
2635
{
2635
{
2636
    // This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
2636
    // This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
2637
    _prsector*      s;
2637
    _prsector*      s;
2638
    sectortype      *sec;
2638
    tsectortype     *sec;
2639
    intptr_t        i;
2639
    intptr_t        i;
2640
2640
2641
    if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
2641
    if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
2642
2642
2643
    s = prsectors[sectnum];
2643
    s = prsectors[sectnum];
2644
    sec = &sector[sectnum];
2644
    sec = (tsectortype *)&sector[sectnum];
2645
2645
2646
    if (s == NULL)
2646
    if (s == NULL)
2647
        return (-1);
2647
        return (-1);
2648
2648
2649
    if (s->floor.indices == NULL)
2649
    if (s->floor.indices == NULL)
Line 2692... Line 2692...
2692
    return (1);
2692
    return (1);
2693
}
2693
}
2694
2694
2695
static void         polymer_drawsector(int16_t sectnum, int32_t domasks)
2695
static void         polymer_drawsector(int16_t sectnum, int32_t domasks)
2696
{
2696
{
2697
    sectortype      *sec;
2697
    tsectortype     *sec;
2698
    _prsector*      s;
2698
    _prsector*      s;
2699
    GLubyte         oldcolor[4];
2699
    GLubyte         oldcolor[4];
2700
    int32_t         draw;
2700
    int32_t         draw;
2701
    int32_t         queuedmask;
2701
    int32_t         queuedmask;
2702
2702
2703
    if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum);
2703
    if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum);
2704
2704
2705
    sec = &sector[sectnum];
2705
    sec = (tsectortype *)&sector[sectnum];
2706
    s = prsectors[sectnum];
2706
    s = prsectors[sectnum];
2707
2707
2708
    queuedmask = FALSE;
2708
    queuedmask = FALSE;
2709
2709
2710
    // If you're thinking of 'optimizing' the following logic, you'd better
2710
    // If you're thinking of 'optimizing' the following logic, you'd better
Line 3238... Line 3238...
3238
    if (pr_verbosity >= 3) OSD_Printf("PR : Updated wall %i.\n", wallnum);
3238
    if (pr_verbosity >= 3) OSD_Printf("PR : Updated wall %i.\n", wallnum);
3239
}
3239
}
3240
3240
3241
static void         polymer_drawwall(int16_t sectnum, int16_t wallnum)
3241
static void         polymer_drawwall(int16_t sectnum, int16_t wallnum)
3242
{
3242
{
3243
    sectortype      *sec;
3243
    tsectortype     *sec;
3244
    walltype        *wal;
3244
    walltype        *wal;
3245
    _prwall         *w;
3245
    _prwall         *w;
3246
    GLubyte         oldcolor[4];
3246
    GLubyte         oldcolor[4];
3247
    int32_t         parallaxedfloor = 0, parallaxedceiling = 0;
3247
    int32_t         parallaxedfloor = 0, parallaxedceiling = 0;
3248
3248
3249
    if (pr_verbosity >= 3) OSD_Printf("PR : Drawing wall %i...\n", wallnum);
3249
    if (pr_verbosity >= 3) OSD_Printf("PR : Drawing wall %i...\n", wallnum);
3250
3250
3251
    sec = &sector[sectnum];
3251
    sec = (tsectortype *)&sector[sectnum];
3252
    wal = &wall[wallnum];
3252
    wal = &wall[wallnum];
3253
    w = prwalls[wallnum];
3253
    w = prwalls[wallnum];
3254
3254
3255
    if ((sec->floorstat & 1) && (wal->nextsector >= 0) &&
3255
    if ((sec->floorstat & 1) && (wal->nextsector >= 0) &&
3256
        (sector[wal->nextsector].floorstat & 1))
3256
        (sector[wal->nextsector].floorstat & 1))