diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index abe50c1b5..f67372e88 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -2731,6 +2731,99 @@ udmf } } + scroll + { + title = "Wall and Plane Scrolling"; + + 500 + { + title = "Scroll Walls"; + prefix = "(500)"; + arg0 + { + title = "Side"; + type = 11; + enum = "frontbackboth"; + } + arg1 + { + title = "Horizontal speed"; + } + arg2 + { + title = "Vertical speed"; + } + } + + 502 + { + title = "Scroll Walls Remotely"; + prefix = "(502)"; + arg0 + { + title = "Linedef tag"; + type = 15; + } + arg1 + { + title = "Side"; + type = 11; + enum = "frontbackboth"; + } + arg2 + { + title = "Horizontal speed"; + } + arg3 + { + title = "Vertical speed"; + } + arg4 + { + title = "Type"; + type = 11; + enum = "scrolltype"; + } + } + + 510 + { + title = "Scroll Planes"; + prefix = "(510)"; + arg0 + { + title = "Sector tag"; + type = 13; + } + arg1 + { + title = "Affected planes"; + type = 11; + enum = "floorceiling"; + } + arg2 + { + title = "Scroll/Carry?"; + type = 11; + enum = "scrollcarry"; + } + arg3 + { + title = "Base speed"; + } + arg4 + { + title = "Type"; + type = 26; + enum = "scrolltype"; + flags + { + 4 = "Exclusive"; + } + } + } + } + light { 606 diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 1fa98a212..8a4bc29e2 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -437,6 +437,13 @@ enums 2 = "Back"; } + frontbackboth + { + 0 = "Front"; + 1 = "Back"; + 2 = "Front and back"; + } + tangibility { 1 = "Intangible from top"; @@ -451,6 +458,20 @@ enums 1 = "Ceiling"; 2 = "Both"; } + + scrollcarry + { + 0 = "Scroll and carry"; + 1 = "Scroll"; + 2 = "Carry"; + } + + scrolltype + { + 0 = "Regular"; + 1 = "Accelerative"; + 2 = "Displacement"; + } } //Default things filters diff --git a/src/p_setup.c b/src/p_setup.c index 46397dafb..9bc87af94 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3659,6 +3659,92 @@ static void P_ConvertBinaryMap(void) case 456: //Stop fading colormap lines[i].args[0] = Tag_FGet(&lines[i].tags); break; + case 500: //Scroll front wall left + case 501: //Scroll front wall right + lines[i].args[0] = 0; + lines[i].args[1] = (lines[i].special == 500) ? -1 : 1; + lines[i].args[2] = 0; + lines[i].special = 500; + break; + case 502: //Scroll tagged wall + case 503: //Scroll tagged wall (accelerative) + case 504: //Scroll tagged wall (displacement) + lines[i].args[0] = tag; + if (lines[i].flags & ML_EFFECT3) + { + if (lines[i].sidenum[1] == 0xffff) + { + CONS_Debug(DBG_GAMELOGIC, "Line special %d (line #%s) missing back side!\n", lines[i].special, sizeu1(i)); + lines[i].special = 0; + break; + } + lines[i].args[1] = 1; + } + else + lines[i].args[1] = 0; + if (lines[i].flags & ML_EFFECT2) + { + lines[i].args[2] = lines[i].dx >> (FRACBITS + SCROLL_SHIFT); + lines[i].args[3] = lines[i].dy >> (FRACBITS + SCROLL_SHIFT); + } + else + { + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + lines[i].args[3] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + } + lines[i].args[4] = lines[i].special - 502; + lines[i].special = 502; + break; + case 505: //Scroll front wall by front side offsets + case 506: //Scroll front wall by back side offsets + case 507: //Scroll back wall by front side offsets + case 508: //Scroll back wall by back side offsets + lines[i].args[0] = lines[i].special >= 507; + if (lines[i].special % 2 == 0) + { + if (lines[i].sidenum[1] == 0xffff) + { + CONS_Debug(DBG_GAMELOGIC, "Line special %d (line #%s) missing back side!\n", lines[i].special, sizeu1(i)); + lines[i].special = 0; + break; + } + lines[i].args[1] = sides[lines[i].sidenum[1]].rowoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[1]].textureoffset >> FRACBITS; + } + else + { + lines[i].args[1] = sides[lines[i].sidenum[0]].rowoffset >> FRACBITS; + lines[i].args[2] = sides[lines[i].sidenum[0]].textureoffset >> FRACBITS; + } + lines[i].special = 500; + break; + case 510: //Scroll floor texture + case 511: //Scroll floor texture (accelerative) + case 512: //Scroll floor texture (displacement) + case 513: //Scroll ceiling texture + case 514: //Scroll ceiling texture (accelerative) + case 515: //Scroll ceiling texture (displacement) + case 520: //Carry objects on floor + case 521: //Carry objects on floor (accelerative) + case 522: //Carry objects on floor (displacement) + case 523: //Carry objects on ceiling + case 524: //Carry objects on ceiling (accelerative) + case 525: //Carry objects on ceiling (displacement) + case 530: //Scroll floor texture and carry objects + case 531: //Scroll floor texture and carry objects (accelerative) + case 532: //Scroll floor texture and carry objects (displacement) + case 533: //Scroll ceiling texture and carry objects + case 534: //Scroll ceiling texture and carry objects (accelerative) + case 535: //Scroll ceiling texture and carry objects (displacement) + lines[i].args[0] = tag; + lines[i].args[1] = ((lines[i].special % 10) < 3) ? TMP_FLOOR : TMP_CEILING; + lines[i].args[2] = ((lines[i].special - 510)/10 + 1) % 3; + lines[i].args[3] = R_PointToDist2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y) >> FRACBITS; + lines[i].args[4] = (lines[i].special % 10) % 3; + if (lines[i].args[2] != 1 && lines[i].flags & ML_NOCLIMB) + lines[i].args[4] |= 4; + lines[i].special = 510; + break; case 606: //Colormap lines[i].args[0] = Tag_FGet(&lines[i].tags); break; diff --git a/src/p_spec.c b/src/p_spec.c index 9987a7c6f..cf6dc5fdd 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -51,9 +51,6 @@ mobj_t *skyboxmo[2]; // current skybox mobjs: 0 = viewpoint, 1 = centerpoint mobj_t *skyboxviewpnts[16]; // array of MT_SKYBOX viewpoint mobjs mobj_t *skyboxcenterpnts[16]; // array of MT_SKYBOX centerpoint mobjs -// Amount (dx, dy) vector linedef is shifted right to get scroll amount -#define SCROLL_SHIFT 5 - /** Animated texture descriptor * This keeps track of an animated texture or an animated flat. * \sa P_UpdateSpecials, P_InitPicAnims, animdef_t @@ -7596,6 +7593,24 @@ static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT3 P_AddThinker(THINK_MAIN, &s->thinker); } +static void P_SpawnPlaneScroller(line_t *l, fixed_t dx, fixed_t dy, INT32 control, INT32 affectee, INT32 accel, INT32 exclusive) +{ + if (l->args[1] != TMP_CEILING) + { + if (l->args[2] != TMS_SCROLLONLY) + Add_Scroller(sc_carry, FixedMul(dx, CARRYFACTOR), FixedMul(dy, CARRYFACTOR), control, affectee, accel, exclusive); + if (l->args[2] != TMS_CARRYONLY) + Add_Scroller(sc_floor, -dx, dy, control, affectee, accel, exclusive); + } + if (l->args[1] != TMP_FLOOR) + { + if (l->args[2] != TMS_SCROLLONLY) + Add_Scroller(sc_carry_ceiling, FixedMul(dx, CARRYFACTOR), FixedMul(dy, CARRYFACTOR), control, affectee, accel, exclusive); + if (l->args[2] != TMS_CARRYONLY) + Add_Scroller(sc_ceiling, -dx, dy, control, affectee, accel, exclusive); + } +} + /** Initializes the scrollers. * * \todo Get rid of all the magic numbers. @@ -7605,140 +7620,65 @@ static void P_SpawnScrollers(void) { size_t i; line_t *l = lines; - mtag_t tag; for (i = 0; i < numlines; i++, l++) { - fixed_t dx = l->dx >> SCROLL_SHIFT; // direction and speed of scrolling - fixed_t dy = l->dy >> SCROLL_SHIFT; INT32 control = -1, accel = 0; // no control sector or acceleration - INT32 special = l->special; - tag = Tag_FGet(&l->tags); - - // These types are same as the ones they get set to except that the - // first side's sector's heights cause scrolling when they change, and - // this linedef controls the direction and speed of the scrolling. The - // most complicated linedef since donuts, but powerful :) - - if (special == 515 || special == 512 || special == 522 || special == 532 || special == 504) // displacement scrollers + if (l->special == 502 || l->special == 510) { - special -= 2; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 514 || special == 511 || special == 521 || special == 531 || special == 503) // accelerative scrollers - { - special--; - accel = 1; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 535 || special == 525) // displacement scrollers - { - special -= 2; - control = (INT32)(sides[*l->sidenum].sector - sectors); - } - else if (special == 534 || special == 524) // accelerative scrollers - { - accel = 1; - special--; - control = (INT32)(sides[*l->sidenum].sector - sectors); + if ((l->args[4] & TMST_TYPEMASK) != TMST_REGULAR) + control = (INT32)(sides[*l->sidenum].sector - sectors); + if ((l->args[4] & TMST_TYPEMASK) == TMST_ACCELERATIVE) + accel = 1; } - switch (special) + switch (l->special) { register INT32 s; - case 513: // scroll effect ceiling - case 533: // scroll and carry objects on ceiling - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - if (special != 533) - break; - /* FALLTHRU */ + case 510: // plane scroller + { + fixed_t length = R_PointToDist2(l->v2->x, l->v2->y, l->v1->x, l->v1->y); + fixed_t speed = l->args[3] << FRACBITS; + fixed_t dx = FixedMul(FixedDiv(l->dx, length), speed) >> SCROLL_SHIFT; + fixed_t dy = FixedMul(FixedDiv(l->dy, length), speed) >> SCROLL_SHIFT; - case 523: // carry objects on ceiling - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - break; - - case 510: // scroll effect floor - case 530: // scroll and carry objects on floor - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); - if (special != 530) - break; - /* FALLTHRU */ - - case 520: // carry objects on floor - dx = FixedMul(dx, CARRYFACTOR); - dy = FixedMul(dy, CARRYFACTOR); - TAG_ITER_SECTORS(tag, s) - Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); + if (l->args[0] == 0) + P_SpawnPlaneScroller(l, dx, dy, control, (INT32)(l->frontsector - sectors), accel, l->args[4] & TMST_EXCLUSIVE); + else + { + TAG_ITER_SECTORS(l->args[0], s) + P_SpawnPlaneScroller(l, dx, dy, control, s, accel, l->args[4] & TMST_EXCLUSIVE); + } break; + } // scroll wall according to linedef // (same direction and speed as scrolling floors) case 502: { - TAG_ITER_LINES(tag, s) + TAG_ITER_LINES(l->args[0], s) if (s != (INT32)i) { - if (l->flags & ML_EFFECT2) // use texture offsets instead - { - dx = sides[l->sidenum[0]].textureoffset; - dy = sides[l->sidenum[0]].rowoffset; - } - if (l->flags & ML_EFFECT3) - { - if (lines[s].sidenum[1] != 0xffff) - Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[1], accel, 0); - } - else - Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0); + if (l->args[1] != TMSD_BACK) + Add_Scroller(sc_side, l->args[2] << FRACBITS, l->args[3] << FRACBITS, control, lines[s].sidenum[0], accel, 0); + if (l->args[1] != TMSD_FRONT && lines[s].sidenum[1] != 0xffff) + Add_Scroller(sc_side, l->args[2] << FRACBITS, l->args[3] << FRACBITS, control, lines[s].sidenum[1], accel, 0); } break; } - case 505: - s = lines[i].sidenum[0]; - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, s, accel, 0); - break; - - case 506: - s = lines[i].sidenum[1]; - - if (s != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[0], accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 506 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 507: - s = lines[i].sidenum[0]; - - if (lines[i].sidenum[1] != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, lines[i].sidenum[1], accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 507 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 508: - s = lines[i].sidenum[1]; - - if (s != 0xffff) - Add_Scroller(sc_side, -sides[s].textureoffset, sides[s].rowoffset, -1, s, accel, 0); - else - CONS_Debug(DBG_GAMELOGIC, "Line special 508 (line #%s) missing back side!\n", sizeu1(i)); - break; - - case 500: // scroll first side - Add_Scroller(sc_side, FRACUNIT, 0, -1, lines[i].sidenum[0], accel, 0); - break; - - case 501: // jff 1/30/98 2-way scroll - Add_Scroller(sc_side, -FRACUNIT, 0, -1, lines[i].sidenum[0], accel, 0); + case 500: + if (l->args[0] != TMSD_BACK) + Add_Scroller(sc_side, -l->args[1] << FRACBITS, l->args[2] << FRACBITS, -1, l->sidenum[0], accel, 0); + if (l->args[0] != TMSD_FRONT) + { + if (l->sidenum[1] != 0xffff) + Add_Scroller(sc_side, -l->args[1] << FRACBITS, l->args[2] << FRACBITS, -1, l->sidenum[1], accel, 0); + else + CONS_Debug(DBG_GAMELOGIC, "Line special 500 (line #%s) missing back side!\n", sizeu1(i)); + } break; } } diff --git a/src/p_spec.h b/src/p_spec.h index 642f7fadf..aa9f85bc8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -21,6 +21,9 @@ extern mobj_t *skyboxmo[2]; // current skybox mobjs: 0 = viewpoint, 1 = centerpo extern mobj_t *skyboxviewpnts[16]; // array of MT_SKYBOX viewpoint mobjs extern mobj_t *skyboxcenterpnts[16]; // array of MT_SKYBOX centerpoint mobjs +// Amount (dx, dy) vector linedef is shifted right to get scroll amount +#define SCROLL_SHIFT 5 + //FOF flags typedef enum { @@ -109,6 +112,29 @@ typedef enum TMP_BOTH = 2, } textmapplanes_t; +typedef enum +{ + TMSD_FRONT = 0, + TMSD_BACK = 1, + TMSD_FRONTBACK = 2, +} textmapsides_t; + +typedef enum +{ + TMS_SCROLLCARRY = 0, + TMS_SCROLLONLY = 1, + TMS_CARRYONLY = 2, +} textmapscroll_t; + +typedef enum +{ + TMST_REGULAR = 0, + TMST_ACCELERATIVE = 1, + TMST_DISPLACEMENT = 2, + TMST_TYPEMASK = 3, + TMST_EXCLUSIVE = 4, +} textmapscrolltype_t; + // GETSECSPECIAL (specialval, section) // // Pulls out the special # from a particular section.