- WallSetup + SpriteSetup

This commit is contained in:
Christoph Oelckers 2021-11-24 20:28:28 +01:00
parent d8893f3521
commit 7e6de45e46
3 changed files with 30 additions and 33 deletions

View file

@ -256,9 +256,10 @@ void WallSetup(void)
case TAG_WALL_SINE_Y_BEGIN:
case TAG_WALL_SINE_X_BEGIN:
{
short wall_num, cnt, num_points, type, tag_end;
walltype* wall_num;
int cnt, num_points, type, tag_end;
SINE_WALLp sw;
short range = 250, speed = 3, peak = 0;
int range = 250, speed = 3, peak = 0;
tag_end = wp->lotag + 2;
@ -266,49 +267,49 @@ void WallSetup(void)
// count up num_points
for (wall_num = wallnum(wp), num_points = 0;
num_points < MAX_SINE_WALL_POINTS && wall[wall_num].lotag != tag_end;
wall_num = wall[wall_num].point2, num_points++)
for (wall_num = wp, num_points = 0;
num_points < MAX_SINE_WALL_POINTS && wall_num->lotag != tag_end;
wall_num = wall_num->point2Wall(), num_points++)
{
if (num_points == 0)
{
if (wall[wall_num].hitag)
range = wall[wall_num].hitag;
if (wall_num->hitag)
range = wall_num->hitag;
}
else if (num_points == 1)
{
if (wall[wall_num].hitag)
speed = wall[wall_num].hitag;
if (wall_num->hitag)
speed = wall_num->hitag;
}
else if (num_points == 2)
{
if (wall[wall_num].hitag)
peak = wall[wall_num].hitag;
if (wall_num->hitag)
peak = wall_num->hitag;
}
}
if (peak)
num_points = peak;
for (wall_num = wallnum(wp), cnt = 0;
cnt < MAX_SINE_WALL_POINTS && wall[wall_num].lotag != tag_end;
wall_num = wall[wall_num].point2, cnt++)
for (wall_num = wp, cnt = 0;
cnt < MAX_SINE_WALL_POINTS && wall_num->lotag != tag_end;
wall_num = wall_num->point2Wall(), cnt++)
{
// set the first on up
sw = &SineWall[NextSineWall][cnt];
sw->type = type;
sw->wall = wall_num;
sw->wall = wallnum(wall_num);
sw->speed_shift = speed;
sw->range = range;
// don't allow bullet holes/stars
SET(wall[wall_num].extra, WALLFX_DONT_STICK);
SET(wall_num->extra, WALLFX_DONT_STICK);
if (!sw->type)
sw->orig_xy = wall[wall_num].y - (sw->range >> 2);
sw->orig_xy = wall_num->y - (sw->range >> 2);
else
sw->orig_xy = wall[wall_num].x - (sw->range >> 2);
sw->orig_xy = wall_num->x - (sw->range >> 2);
sw->sintable_ndx = cnt * (2048 / num_points);
}

View file

@ -2799,9 +2799,6 @@ void SpriteSetup(void)
case WARP_TELEPORTER:
{
short start_wall, wall_num;
short sectnum = sp->sectnum;
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
SET(sp->sector()->extra, SECTFX_WARP_SECTOR);
change_actor_stat(actor, STAT_WARP);
@ -2812,18 +2809,19 @@ void SpriteSetup(void)
break;
// move the the next wall
wall_num = start_wall = sector[sectnum].wallptr;
auto start_wall = sp->sector()->firstWall();
auto wall_num = start_wall;
// Travel all the way around loop setting wall bits
do
{
// DO NOT TAG WHITE WALLS!
if (validWallIndex(wall[wall_num].nextwall))
if (validWallIndex(wall_num->nextwall))
{
SET(wall[wall_num].cstat, CSTAT_WALL_WARP_HITSCAN);
SET(wall_num->cstat, CSTAT_WALL_WARP_HITSCAN);
}
wall_num = wall[wall_num].point2;
wall_num = wall_num->point2Wall();
}
while (wall_num != start_wall);
@ -2923,20 +2921,18 @@ void SpriteSetup(void)
case SECT_ACTOR_BLOCK:
{
short start_wall, wall_num;
short sectnum = sp->sectnum;
// move the the next wall
wall_num = start_wall = sector[sectnum].wallptr;
auto start_wall = sp->sector()->firstWall();
auto wall_num = start_wall;
// Travel all the way around loop setting wall bits
do
{
SET(wall[wall_num].cstat, CSTAT_WALL_BLOCK_ACTOR);
uint16_t const nextwall = wall[wall_num].nextwall;
SET(wall_num->cstat, CSTAT_WALL_BLOCK_ACTOR);
uint16_t const nextwall = wall_num->nextwall;
if (validWallIndex(nextwall))
SET(wall[nextwall].cstat, CSTAT_WALL_BLOCK_ACTOR);
wall_num = wall[wall_num].point2;
wall_num = wall_num->point2Wall();
}
while (wall_num != start_wall);

View file

@ -526,7 +526,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
// Sine wave wall effect - max 5 per level
//
// EXP - Tag the first wall with 300, last with 302.
// Use point2 to see which direction the wall goes.
// Use point 2 to see which direction the wall goes.
//
// 1st Sector High Tag = range
// 2nd Sector High Tag = speed