Subversion Repositories eduke32

Rev

Rev 4879 | Rev 4913 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4879 Rev 4898
Line 4952... Line 4952...
4952
                       int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss)
4952
                       int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss)
4953
{
4953
{
4954
    int32_t p;
4954
    int32_t p;
4955
    int32_t i;
4955
    int32_t i;
4956
    spritetype *s;
4956
    spritetype *s;
4957
    spritetype spr_temp;
4957
    tspritetype spr_temp;
4958
4958
4959
    // NetAlloc
4959
    // NetAlloc
4960
    if (Net_IsRelevantStat(s_ss))
4960
    if (Net_IsRelevantStat(s_ss))
4961
    {
4961
    {
4962
        i = Net_InsertSprite(whatsect,s_ss);
4962
        i = Net_InsertSprite(whatsect,s_ss);
Line 7033... Line 7033...
7033
    }
7033
    }
7034
7034
7035
    return i;
7035
    return i;
7036
}
7036
}
7037
7037
7038
static int32_t G_MaybeTakeOnFloorPal(spritetype *datspr, int32_t sect)
7038
static int32_t G_MaybeTakeOnFloorPal(tspritetype *datspr, int32_t sect)
7039
{
7039
{
7040
    int32_t dapal = sector[sect].floorpal;
7040
    int32_t dapal = sector[sect].floorpal;
7041
7041
7042
    if (dapal && !g_noFloorPal[dapal]
7042
    if (dapal && !g_noFloorPal[dapal]
7043
            && !A_CheckSpriteFlags(datspr->owner,SFLAG_NOPAL))
7043
            && !A_CheckSpriteFlags(datspr->owner,SFLAG_NOPAL))
Line 7047... Line 7047...
7047
    }
7047
    }
7048
7048
7049
    return 0;
7049
    return 0;
7050
}
7050
}
7051
7051
7052
static int32_t getofs_viewtype5(const spritetype *s, spritetype *t, int32_t a, uint8_t invertp)
7052
static int32_t getofs_viewtype5(const tspritetype *s, tspritetype *t, int32_t a, uint8_t invertp)
7053
{
7053
{
7054
    int32_t angdif = invertp ? a-s->ang : s->ang-a;
7054
    int32_t angdif = invertp ? a-s->ang : s->ang-a;
7055
    int32_t k = (((angdif+3072+128)&2047)>>8)&7;
7055
    int32_t k = (((angdif+3072+128)&2047)>>8)&7;
7056
7056
7057
    if (k>4)
7057
    if (k>4)
Line 7062... Line 7062...
7062
    else t->cstat &= ~4;
7062
    else t->cstat &= ~4;
7063
7063
7064
    return k;
7064
    return k;
7065
}
7065
}
7066
7066
7067
static int32_t getofs_viewtype7(const spritetype *s, spritetype *t, int32_t a, uint8_t invertp)
7067
static int32_t getofs_viewtype7(const tspritetype *s, tspritetype *t, int32_t a, uint8_t invertp)
7068
{
7068
{
7069
    int32_t angdif = invertp ? a-s->ang : s->ang-a;
7069
    int32_t angdif = invertp ? a-s->ang : s->ang-a;
7070
    int32_t k = ((angdif+3072+128)&2047)/170;
7070
    int32_t k = ((angdif+3072+128)&2047)/170;
7071
7071
7072
    if (k>6)
7072
    if (k>6)
Line 7178... Line 7178...
7178
#ifdef LEGACY_ROR
7178
#ifdef LEGACY_ROR
7179
    ror_sprite = -1;
7179
    ror_sprite = -1;
7180
#endif
7180
#endif
7181
    for (j=spritesortcnt-1; j>=0; j--)
7181
    for (j=spritesortcnt-1; j>=0; j--)
7182
    {
7182
    {
7183
        spritetype *const t = &tsprite[j];
7183
        tspritetype *const t = &tsprite[j];
7184
        const int32_t i = t->owner;
7184
        const int32_t i = t->owner;
7185
        const spritetype *const s = &sprite[i];
7185
        const spritetype *const s = &sprite[i];
7186
7186
7187
        switch (DYNAMICTILEMAP(s->picnum))
7187
        switch (DYNAMICTILEMAP(s->picnum))
7188
        {
7188
        {
Line 7207... Line 7207...
7207
        }
7207
        }
7208
    }
7208
    }
7209
7209
7210
    for (j=spritesortcnt-1; j>=0; j--)
7210
    for (j=spritesortcnt-1; j>=0; j--)
7211
    {
7211
    {
7212
        spritetype *const t = &tsprite[j];
7212
        tspritetype *const t = &tsprite[j];
7213
        const int32_t i = t->owner;
7213
        const int32_t i = t->owner;
7214
        const spritetype *const s = &sprite[i];
7214
        const spritetype *const s = &sprite[i];
7215
7215
7216
        if (t->picnum < GREENSLIME || t->picnum > GREENSLIME+7)
7216
        if (t->picnum < GREENSLIME || t->picnum > GREENSLIME+7)
7217
            switch (DYNAMICTILEMAP(t->picnum))
7217
            switch (DYNAMICTILEMAP(t->picnum))
Line 7265... Line 7265...
7265
            case NEON5__STATIC:
7265
            case NEON5__STATIC:
7266
            case NEON6__STATIC:
7266
            case NEON6__STATIC:
7267
                continue;
7267
                continue;
7268
            default:
7268
            default:
7269
                // NOTE: wall-aligned sprites will never take on ceiling/floor shade...
7269
                // NOTE: wall-aligned sprites will never take on ceiling/floor shade...
7270
                if ((t->cstat&16) || (A_CheckEnemySprite(t) && t->extra > 0) || t->statnum == STAT_PLAYER)
7270
                if ((t->cstat&16) || (A_CheckEnemySprite((const spritetype *)t) && t->extra > 0) || t->statnum == STAT_PLAYER)
7271
                    continue;
7271
                    continue;
7272
            }
7272
            }
7273
7273
7274
        // ... since this is not reached:
7274
        // ... since this is not reached:
7275
        if (A_CheckSpriteFlags(t->owner, SFLAG_NOSHADE) || (t->cstat&CSTAT_SPRITE_NOSHADE))
7275
        if (A_CheckSpriteFlags(t->owner, SFLAG_NOSHADE) || (t->cstat&CSTAT_SPRITE_NOSHADE))
Line 7296... Line 7296...
7296
        int32_t scrofs_action;
7296
        int32_t scrofs_action;
7297
#else
7297
#else
7298
        int32_t startframe, viewtype;
7298
        int32_t startframe, viewtype;
7299
#endif
7299
#endif
7300
        //is the perfect time to animate sprites
7300
        //is the perfect time to animate sprites
7301
        spritetype *const t = &tsprite[j];
7301
        tspritetype *const t = &tsprite[j];
7302
        const int32_t i = t->owner;
7302
        const int32_t i = t->owner;
7303
        // XXX: what's up with the (i < 0) check?
7303
        // XXX: what's up with the (i < 0) check?
7304
        // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
7304
        // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
7305
        spritetype *const s = (i < 0) ? &tsprite[j] : &sprite[i];
7305
        tspritetype *const s = (i < 0) ? &tsprite[j] : (tspritetype *)&sprite[i];
7306
7306
7307
        if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(s->picnum)))
7307
        if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(s->picnum)))
7308
        {
7308
        {
7309
            t->xrepeat = t->yrepeat = 0;
7309
            t->xrepeat = t->yrepeat = 0;
7310
            continue;
7310
            continue;
Line 7320... Line 7320...
7320
            continue;
7320
            continue;
7321
7321
7322
        Bassert(i >= 0);
7322
        Bassert(i >= 0);
7323
7323
7324
        {
7324
        {
7325
            int32_t snum = P_GetP(s);
7325
            int32_t snum = P_GetP((const spritetype *)s);
7326
            const DukePlayer_t *const ps = g_player[snum].ps;
7326
            const DukePlayer_t *const ps = g_player[snum].ps;
7327
7327
7328
            if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps->newowner == -1 && s->owner >= 0)
7328
            if (s->statnum != STAT_ACTOR && s->picnum == APLAYER && ps->newowner == -1 && s->owner >= 0)
7329
            {
7329
            {
7330
                t->x -= mulscale16(65536-smoothratio,ps->pos.x-ps->opos.x);
7330
                t->x -= mulscale16(65536-smoothratio,ps->pos.x-ps->opos.x);
Line 7400... Line 7400...
7400
                    getangle(
7400
                    getangle(
7401
                        sprite[s->owner].x-t->x,
7401
                        sprite[s->owner].x-t->x,
7402
                        sprite[s->owner].y-t->y);
7402
                        sprite[s->owner].y-t->y);
7403
7403
7404
                if (klabs(G_GetAngleDelta(sqa,sqb)) > 512)
7404
                if (klabs(G_GetAngleDelta(sqa,sqb)) > 512)
7405
                    if (ldist(&sprite[s->owner],t) < ldist(&sprite[g_player[screenpeek].ps->i],&sprite[s->owner]))
7405
                    if (ldist(&sprite[s->owner],(const spritetype *)t) < ldist(&sprite[g_player[screenpeek].ps->i],&sprite[s->owner]))
7406
                        t->xrepeat = t->yrepeat = 0;
7406
                        t->xrepeat = t->yrepeat = 0;
7407
            }
7407
            }
7408
            continue;
7408
            continue;
7409
        case BURNING__STATIC:
7409
        case BURNING__STATIC:
7410
        case BURNING2__STATIC:
7410
        case BURNING2__STATIC:
Line 7501... Line 7501...
7501
            t->picnum = RECON+k;
7501
            t->picnum = RECON+k;
7502
7502
7503
            break;
7503
            break;
7504
7504
7505
        case APLAYER__STATIC:
7505
        case APLAYER__STATIC:
7506
            p = P_GetP(s);
7506
            p = P_GetP((const spritetype *)s);
7507
7507
7508
            if (t->pal == 1) t->z -= (18<<8);
7508
            if (t->pal == 1) t->z -= (18<<8);
7509
7509
7510
            if (g_player[p].ps->over_shoulder_on > 0 && g_player[p].ps->newowner < 0)
7510
            if (g_player[p].ps->over_shoulder_on > 0 && g_player[p].ps->newowner < 0)
7511
            {
7511
            {
Line 7543... Line 7543...
7543
            if ((g_netServer || ud.multimode > 1) && (display_mirror || screenpeek != p || s->owner == -1))
7543
            if ((g_netServer || ud.multimode > 1) && (display_mirror || screenpeek != p || s->owner == -1))
7544
            {
7544
            {
7545
                if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0
7545
                if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0
7546
                        && spritesortcnt < MAXSPRITESONSCREEN)
7546
                        && spritesortcnt < MAXSPRITESONSCREEN)
7547
                {
7547
                {
7548
                    spritetype *const newt = &tsprite[spritesortcnt];
7548
                    tspritetype *const newt = &tsprite[spritesortcnt];
7549
                    int32_t curweap = g_player[p].ps->curr_weapon;
7549
                    int32_t curweap = g_player[p].ps->curr_weapon;
7550
7550
7551
                    Bmemcpy(newt, t, sizeof(spritetype));
7551
                    Bmemcpy(newt, t, sizeof(spritetype));
7552
7552
7553
                    newt->statnum = TSPR_TEMP;
7553
                    newt->statnum = TSPR_TEMP;
Line 7573... Line 7573...
7573
                    spritesortcnt++;
7573
                    spritesortcnt++;
7574
                }
7574
                }
7575
7575
7576
                if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on && spritesortcnt<MAXSPRITESONSCREEN)
7576
                if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on && spritesortcnt<MAXSPRITESONSCREEN)
7577
                {
7577
                {
7578
                    spritetype *const newt = &tsprite[spritesortcnt];
7578
                    tspritetype *const newt = &tsprite[spritesortcnt];
7579
7579
7580
                    Bmemcpy(newt, t, sizeof(spritetype));
7580
                    Bmemcpy(newt, t, sizeof(spritetype));
7581
7581
7582
                    newt->statnum = TSPR_TEMP;
7582
                    newt->statnum = TSPR_TEMP;
7583
7583
Line 7808... Line 7808...
7808
        // Night vision goggles tsprite tinting.
7808
        // Night vision goggles tsprite tinting.
7809
        // XXX: Currently, for the splitscreen mod, sprites will be pal6-colored iff the first
7809
        // XXX: Currently, for the splitscreen mod, sprites will be pal6-colored iff the first
7810
        // player has nightvision on.  We should pass stuff like "from which player is this view
7810
        // player has nightvision on.  We should pass stuff like "from which player is this view
7811
        // supposed to be" as parameters ("drawing context") instead of relying on globals.
7811
        // supposed to be" as parameters ("drawing context") instead of relying on globals.
7812
        if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
7812
        if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
7813
                (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
7813
                (A_CheckEnemySprite((const spritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
7814
        {
7814
        {
7815
            t->pal = 6;
7815
            t->pal = 6;
7816
            t->shade = 0;
7816
            t->shade = 0;
7817
        }
7817
        }
7818
7818
7819
        // Fake floor shadow, implemented by inserting a new tsprite.
7819
        // Fake floor shadow, implemented by inserting a new tsprite.
7820
        if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0))
7820
        if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite((const spritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0))
7821
            if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT)
7821
            if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT)
7822
            {
7822
            {
7823
                if (actor[i].dispicnum < 0)
7823
                if (actor[i].dispicnum < 0)
7824
                {
7824
                {
7825
#ifdef DEBUGGINGAIDS
7825
#ifdef DEBUGGINGAIDS
Line 7844... Line 7844...
7844
                    else
7844
                    else
7845
                        daz = actor[i].floorz;
7845
                        daz = actor[i].floorz;
7846
7846
7847
                    if ((s->z-daz) < (8<<8) && g_player[screenpeek].ps->pos.z < daz)
7847
                    if ((s->z-daz) < (8<<8) && g_player[screenpeek].ps->pos.z < daz)
7848
                    {
7848
                    {
7849
                        spritetype *const newt = &tsprite[spritesortcnt];
7849
                        tspritetype *const newt = &tsprite[spritesortcnt];
7850
7850
7851
                        Bmemcpy(newt, t, sizeof(spritetype));
7851
                        Bmemcpy(newt, t, sizeof(spritetype));
7852
7852
7853
                        newt->statnum = TSPR_TEMP;
7853
                        newt->statnum = TSPR_TEMP;
7854
7854