Subversion Repositories eduke32

Rev

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

Rev 4974 Rev 4981
Line 106... Line 106...
106
        if (sprite[k].picnum==CAMERA1)
106
        if (sprite[k].picnum==CAMERA1)
107
            sprite[k].yvel = 0;
107
            sprite[k].yvel = 0;
108
}
108
}
109
109
110
// Manhattan distance between wall-point and sprite.
110
// Manhattan distance between wall-point and sprite.
111
static int32_t G_WallSpriteDist(const walltype *wal, const spritetype *spr)
111
static inline int32_t G_WallSpriteDist(const twalltype *wal, const spritetype *spr)
112
{
112
{
113
    return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
113
    return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
114
}
114
}
115
115
116
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
116
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
Line 137... Line 137...
137
137
138
        sectorlist[0] = s->sectnum;
138
        sectorlist[0] = s->sectnum;
139
139
140
        do
140
        do
141
        {
141
        {
142
            const walltype *wal;
142
            const twalltype *wal;
143
            const int32_t dasect = sectorlist[sectcnt++];
143
            const int32_t dasect = sectorlist[sectcnt++];
144
            const int32_t startwall = sector[dasect].wallptr;
144
            const int32_t startwall = sector[dasect].wallptr;
145
            const int32_t endwall = startwall+sector[dasect].wallnum;
145
            const int32_t endwall = startwall+sector[dasect].wallnum;
146
146
147
            int32_t w;
147
            int32_t w;
148
            const int32_t w2 = wall[startwall].point2;
148
            const int32_t w2 = wall[startwall].point2;
149
149
150
            // Check if "hit" 1st or 3rd wall-point. This mainly makes sense
150
            // Check if "hit" 1st or 3rd wall-point. This mainly makes sense
151
            // for rectangular "ceiling light"-style sectors.
151
            // for rectangular "ceiling light"-style sectors.
152
            if (G_WallSpriteDist(&wall[startwall], s) < r ||
152
            if (G_WallSpriteDist((twalltype *)&wall[startwall], s) < r ||
153
                    G_WallSpriteDist(&wall[wall[w2].point2], s) < r)
153
                    G_WallSpriteDist((twalltype *)&wall[wall[w2].point2], s) < r)
154
            {
154
            {
155
                if (((sector[dasect].ceilingz-s->z)>>8) < r)
155
                if (((sector[dasect].ceilingz-s->z)>>8) < r)
156
                    Sect_DamageCeilingOrFloor(0, dasect);
156
                    Sect_DamageCeilingOrFloor(0, dasect);
157
                if (((s->z-sector[dasect].floorz)>>8) < r)
157
                if (((s->z-sector[dasect].floorz)>>8) < r)
158
                    Sect_DamageCeilingOrFloor(1, dasect);
158
                    Sect_DamageCeilingOrFloor(1, dasect);
159
            }
159
            }
160
160
161
            for (w=startwall,wal=&wall[startwall]; w<endwall; w++,wal++)
161
            for (w=startwall,wal=(twalltype *)&wall[startwall]; w<endwall; w++,wal++)
162
                if (G_WallSpriteDist(wal, s) < r)
162
                if (G_WallSpriteDist(wal, s) < r)
163
                {
163
                {
164
                    int16_t sect = -1;
164
                    int16_t sect = -1;
165
                    const int32_t nextsect = wal->nextsector;
165
                    const int32_t nextsect = wal->nextsector;
166
                    int32_t x1, y1;
166
                    int32_t x1, y1;