diff --git a/src/p_floor.c b/src/p_floor.c index b8b40df3c..b916014b2 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1275,478 +1275,6 @@ void T_FloatSector(levelspecthink_t *floater) } } -// -// T_BridgeThinker -// -// Kind of like T_RaiseSector, -// but spreads out across -// multiple FOFs at varying -// intensity. -// -void T_BridgeThinker(levelspecthink_t *bridge) -{ - msecnode_t *node; - mobj_t *thing; - sector_t *sector; - sector_t *controlsec = NULL; - INT32 i, k; - - INT16 j; - boolean playeronme = false; - fixed_t ceilingdestination = 0, floordestination = 0; - result_e res = 0; - -#define ORIGFLOORHEIGHT (bridge->vars[0]) -#define ORIGCEILINGHEIGHT (bridge->vars[1]) -#define BASESPEED (bridge->vars[2]) -#define CURSPEED (bridge->vars[3]) -#define STARTTAG ((INT16)bridge->vars[4]) -#define ENDTAG ((INT16)bridge->vars[5]) -#define DIRECTION (bridge->vars[8]) -#define SAGAMT (8*FRACUNIT) - fixed_t lowceilheight = ORIGCEILINGHEIGHT - SAGAMT; - fixed_t lowfloorheight = ORIGFLOORHEIGHT - SAGAMT; -#define LOWCEILINGHEIGHT (lowceilheight) -#define LOWFLOORHEIGHT (lowfloorheight) -#define STARTCONTROLTAG (ENDTAG + 1) -#define ENDCONTROLTAG (ENDTAG + (ENDTAG - STARTTAG) + 1) - - // Is someone standing on it? - for (j = STARTTAG; j <= ENDTAG; j++) - { - for (i = -1; (i = P_FindSectorFromTag(j, i)) >= 0 ;) - { - sector = §ors[i]; - - // Nab the control sector that this sector belongs to. - k = P_FindSectorFromTag((INT16)(j + (ENDTAG-STARTTAG) + 1), -1); - - if (k == -1) - break; - - controlsec = §ors[k]; - - // Is a player standing on me? - for (node = sector->touching_thinglist; node; node = node->m_thinglist_next) - { - thing = node->m_thing; - - if (!thing->player) - continue; - - if (!(thing->z == controlsec->ceilingheight)) - continue; - - playeronme = true; - goto wegotit; // Just take the first one? - } - } - } -wegotit: - if (playeronme) - { - // Lower controlsec like a regular T_RaiseSector - // Set the heights of all the other control sectors to - // be a gradient of this height toward the edges - } - else - { - // Raise controlsec like a regular T_RaiseSector - // Set the heights of all the other control sectors to - // be a gradient of this height toward the edges. - } - - if (playeronme && controlsec) - { - INT32 dist; - - bridge->sector = controlsec; - CURSPEED = BASESPEED; - - { - // Translate tags to - 0 + range - /*so you have a number in [min, max]. - let range = max - min, subtract min - from your number to get [0, range]. - subtract range/2 to get [-range/2, range/2]. - take absolute value and get [0, range/2] where - lower number = closer to midpoint. divide by - range/2 to get [0, 1]. subtract that number - from 1 to get [0, 1] with higher number = closer - to midpoint. multiply this by max sag amount*/ - - INT32 midpoint = STARTCONTROLTAG + ((ENDCONTROLTAG-STARTCONTROLTAG) + 1)/2; -// INT32 tagstart = STARTTAG - midpoint; -// INT32 tagend = ENDTAG - midpoint; - -// CONS_Debug(DBG_GAMELOGIC, "tagstart is %d, tagend is %d\n", tagstart, tagend); - - // Sag is adjusted by how close you are to the center - dist = ((ENDCONTROLTAG - STARTCONTROLTAG))/2 - abs(bridge->sector->tag - midpoint); - -// CONS_Debug(DBG_GAMELOGIC, "Dist is %d\n", dist); - LOWCEILINGHEIGHT -= (SAGAMT) * dist; - LOWFLOORHEIGHT -= (SAGAMT) * dist; - } - - // go down - if (bridge->sector->ceilingheight <= LOWCEILINGHEIGHT) - { - bridge->sector->floorheight = LOWCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); - bridge->sector->ceilingheight = LOWCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; - goto dorest; - } - - DIRECTION = -1; - ceilingdestination = LOWCEILINGHEIGHT; - floordestination = LOWFLOORHEIGHT; - - if ((bridge->sector->ceilingheight - LOWCEILINGHEIGHT) - < (ORIGCEILINGHEIGHT - bridge->sector->ceilingheight)) - { - fixed_t origspeed = CURSPEED; - - // Slow down as you get closer to the bottom - CURSPEED = FixedMul(CURSPEED,FixedDiv(bridge->sector->ceilingheight - LOWCEILINGHEIGHT, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - else - { - fixed_t origspeed = CURSPEED; - // Slow down as you get closer to the top - CURSPEED = FixedMul(CURSPEED,FixedDiv(ORIGCEILINGHEIGHT - bridge->sector->ceilingheight, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - -// CONS_Debug(DBG_GAMELOGIC, "Curspeed is %d\n", CURSPEED>>FRACBITS); - - res = T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - ceilingdestination, // dest - 0, // crush - 1, // floor or ceiling (1 for ceiling) - DIRECTION // direction - ); - - if (res == ok || res == pastdest) - T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - floordestination, // dest - 0, // crush - 0, // floor or ceiling (0 for floor) - DIRECTION // direction - ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; - - dorest: - // Adjust joined sector heights - { - sector_t *sourcesec = bridge->sector; - - INT32 divisor = sourcesec->tag - ENDTAG + 1; - fixed_t heightdiff = ORIGCEILINGHEIGHT - sourcesec->ceilingheight; - fixed_t interval; - INT32 plusplusme = 0; - - if (divisor > 0) - { - interval = heightdiff/divisor; - -// CONS_Debug(DBG_GAMELOGIC, "interval is %d\n", interval>>FRACBITS); - - // TODO: Use T_MovePlane - - for (j = (INT16)(ENDTAG+1); j <= sourcesec->tag; j++, plusplusme++) - { - for (i = -1; (i = P_FindSectorFromTag(j, i)) >= 0 ;) - { - if (sectors[i].ceilingheight >= sourcesec->ceilingheight) - { - sectors[i].ceilingheight = ORIGCEILINGHEIGHT - (interval*plusplusme); - sectors[i].floorheight = ORIGFLOORHEIGHT - (interval*plusplusme); - } - else // Do the regular rise - { - bridge->sector = §ors[i]; - - CURSPEED = BASESPEED/2; - - // rise back up - if (bridge->sector->ceilingheight >= ORIGCEILINGHEIGHT) - { - bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); - bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; - continue; - } - - DIRECTION = 1; - ceilingdestination = ORIGCEILINGHEIGHT; - floordestination = ORIGFLOORHEIGHT; - -// CONS_Debug(DBG_GAMELOGIC, "ceildest: %d, floordest: %d\n", ceilingdestination>>FRACBITS, floordestination>>FRACBITS); - - if ((bridge->sector->ceilingheight - LOWCEILINGHEIGHT) - < (ORIGCEILINGHEIGHT - bridge->sector->ceilingheight)) - { - fixed_t origspeed = CURSPEED; - - // Slow down as you get closer to the bottom - CURSPEED = FixedMul(CURSPEED,FixedDiv(bridge->sector->ceilingheight - LOWCEILINGHEIGHT, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - else - { - fixed_t origspeed = CURSPEED; - // Slow down as you get closer to the top - CURSPEED = FixedMul(CURSPEED,FixedDiv(ORIGCEILINGHEIGHT - bridge->sector->ceilingheight, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - - res = T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - ceilingdestination, // dest - 0, // crush - 1, // floor or ceiling (1 for ceiling) - DIRECTION // direction - ); - - if (res == ok || res == pastdest) - T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - floordestination, // dest - 0, // crush - 0, // floor or ceiling (0 for floor) - DIRECTION // direction - ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; - } - } - } - } - - // Now the other side - divisor = ENDTAG + (ENDTAG-STARTTAG) + 1; - divisor -= sourcesec->tag; - - if (divisor > 0) - { - interval = heightdiff/divisor; - plusplusme = 0; - -// CONS_Debug(DBG_GAMELOGIC, "interval2 is %d\n", interval>>FRACBITS); - - for (j = (INT16)(sourcesec->tag+1); j <= ENDTAG + (ENDTAG-STARTTAG) + 1; j++, plusplusme++) - { - for (i = -1; (i = P_FindSectorFromTag(j, i)) >= 0 ;) - { - if (sectors[i].ceilingheight >= sourcesec->ceilingheight) - { - sectors[i].ceilingheight = sourcesec->ceilingheight + (interval*plusplusme); - sectors[i].floorheight = sourcesec->floorheight + (interval*plusplusme); - } - else // Do the regular rise - { - bridge->sector = §ors[i]; - - CURSPEED = BASESPEED/2; - - // rise back up - if (bridge->sector->ceilingheight >= ORIGCEILINGHEIGHT) - { - bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); - bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; - continue; - } - - DIRECTION = 1; - ceilingdestination = ORIGCEILINGHEIGHT; - floordestination = ORIGFLOORHEIGHT; - -// CONS_Debug(DBG_GAMELOGIC, "ceildest: %d, floordest: %d\n", ceilingdestination>>FRACBITS, floordestination>>FRACBITS); - - if ((bridge->sector->ceilingheight - LOWCEILINGHEIGHT) - < (ORIGCEILINGHEIGHT - bridge->sector->ceilingheight)) - { - fixed_t origspeed = CURSPEED; - - // Slow down as you get closer to the bottom - CURSPEED = FixedMul(CURSPEED,FixedDiv(bridge->sector->ceilingheight - LOWCEILINGHEIGHT, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - else - { - fixed_t origspeed = CURSPEED; - // Slow down as you get closer to the top - CURSPEED = FixedMul(CURSPEED,FixedDiv(ORIGCEILINGHEIGHT - bridge->sector->ceilingheight, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - - res = T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - ceilingdestination, // dest - 0, // crush - 1, // floor or ceiling (1 for ceiling) - DIRECTION // direction - ); - - if (res == ok || res == pastdest) - T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - floordestination, // dest - 0, // crush - 0, // floor or ceiling (0 for floor) - DIRECTION // direction - ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; - } - } - } - } - } - - // for (i = -1; (i = P_FindSectorFromTag(bridge->sourceline->tag, i)) >= 0 ;) - // P_RecalcPrecipInSector(§ors[i]); - } - else - { - // Iterate control sectors - for (j = (INT16)(ENDTAG+1); j <= (ENDTAG+(ENDTAG-STARTTAG)+1); j++) - { - for (i = -1; (i = P_FindSectorFromTag(j, i)) >= 0 ;) - { - bridge->sector = §ors[i]; - - CURSPEED = BASESPEED/2; - - // rise back up - if (bridge->sector->ceilingheight >= ORIGCEILINGHEIGHT) - { - bridge->sector->floorheight = ORIGCEILINGHEIGHT - (bridge->sector->ceilingheight - bridge->sector->floorheight); - bridge->sector->ceilingheight = ORIGCEILINGHEIGHT; - bridge->sector->ceilspeed = 0; - bridge->sector->floorspeed = 0; - continue; - } - - DIRECTION = 1; - ceilingdestination = ORIGCEILINGHEIGHT; - floordestination = ORIGFLOORHEIGHT; - -// CONS_Debug(DBG_GAMELOGIC, "ceildest: %d, floordest: %d\n", ceilingdestination>>FRACBITS, floordestination>>FRACBITS); - - if ((bridge->sector->ceilingheight - LOWCEILINGHEIGHT) - < (ORIGCEILINGHEIGHT - bridge->sector->ceilingheight)) - { - fixed_t origspeed = CURSPEED; - - // Slow down as you get closer to the bottom - CURSPEED = FixedMul(CURSPEED,FixedDiv(bridge->sector->ceilingheight - LOWCEILINGHEIGHT, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - else - { - fixed_t origspeed = CURSPEED; - // Slow down as you get closer to the top - CURSPEED = FixedMul(CURSPEED,FixedDiv(ORIGCEILINGHEIGHT - bridge->sector->ceilingheight, (ORIGCEILINGHEIGHT - LOWCEILINGHEIGHT)>>5)); - - if (CURSPEED <= origspeed/16) - CURSPEED = origspeed/16; - else if (CURSPEED > origspeed) - CURSPEED = origspeed; - } - - res = T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - ceilingdestination, // dest - 0, // crush - 1, // floor or ceiling (1 for ceiling) - DIRECTION // direction - ); - - if (res == ok || res == pastdest) - T_MovePlane - ( - bridge->sector, // sector - CURSPEED, // speed - floordestination, // dest - 0, // crush - 0, // floor or ceiling (0 for floor) - DIRECTION // direction - ); - - bridge->sector->ceilspeed = 42; - bridge->sector->floorspeed = CURSPEED*DIRECTION; - } - } - // Update precip - } - -#undef SAGAMT -#undef LOWFLOORHEIGHT -#undef LOWCEILINGHEIGHT -#undef ORIGFLOORHEIGHT -#undef ORIGCEILINGHEIGHT -#undef BASESPEED -#undef CURSPEED -#undef STARTTAG -#undef ENDTAG -#undef DIRECTION -} - static mobj_t *SearchMarioNode(msecnode_t *node) { mobj_t *thing = NULL; diff --git a/src/p_saveg.c b/src/p_saveg.c index 716904432..259e58168 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1275,7 +1275,6 @@ typedef enum tc_marioblockchecker, tc_spikesector, tc_floatsector, - tc_bridgethinker, tc_crushceiling, tc_scroll, tc_friction, @@ -2291,11 +2290,6 @@ static void P_NetArchiveThinkers(void) SaveSpecialLevelThinker(th, tc_floatsector); continue; } - else if (th->function.acp1 == (actionf_p1)T_BridgeThinker) - { - SaveSpecialLevelThinker(th, tc_bridgethinker); - continue; - } else if (th->function.acp1 == (actionf_p1)T_LaserFlash) { SaveLaserThinker(th, tc_laserflash); @@ -3487,10 +3481,6 @@ static void P_NetUnArchiveThinkers(void) th = LoadSpecialLevelThinker((actionf_p1)T_FloatSector, 0); break; - case tc_bridgethinker: - th = LoadSpecialLevelThinker((actionf_p1)T_BridgeThinker, 3); - break; - case tc_laserflash: th = LoadLaserThinker((actionf_p1)T_LaserFlash); break; diff --git a/src/p_spec.c b/src/p_spec.c index 50b767535..8e56f2efe 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2041,7 +2041,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller INT32 triggercolor = (INT32)sides[triggerline->sidenum[0]].toptexture; UINT8 color = (actor->player ? actor->player->powers[pw_dye] : actor->color); boolean invert = (triggerline->flags & ML_NOCLIMB ? true : false); - + if (invert ^ (triggercolor != color)) return false; } @@ -4050,23 +4050,23 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } } break; - + case 463: // Dye object { INT32 color = sides[line->sidenum[0]].toptexture; - + if (mo) { if (color < 0 || color >= MAXTRANSLATIONS) return; - + var1 = 0; var2 = color; A_Dye(mo); } } break; - + #ifdef POLYOBJECTS case 480: // Polyobj_DoorSlide case 481: // Polyobj_DoorSwing @@ -5975,39 +5975,6 @@ static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline) floater->sourceline = sourceline; } -/** Adds a bridge thinker. - * Bridge thinkers cause a group of FOFs to behave like - * a bridge made up of pieces, that bows under weight. - * - * \param sec Control sector. - * \sa P_SpawnSpecials, T_BridgeThinker - * \author SSNTails - */ -/* -static inline void P_AddBridgeThinker(line_t *sourceline, sector_t *sec) -{ - levelspecthink_t *bridge; - - // create an initialize new thinker - bridge = Z_Calloc(sizeof (*bridge), PU_LEVSPEC, NULL); - P_AddThinker(THINK_MAIN, &bridge->thinker); - - bridge->thinker.function.acp1 = (actionf_p1)T_BridgeThinker; - - bridge->sector = sec; - bridge->vars[0] = sourceline->frontsector->floorheight; - bridge->vars[1] = sourceline->frontsector->ceilingheight; - bridge->vars[2] = P_AproxDistance(sourceline->dx, sourceline->dy); // Speed - bridge->vars[2] = FixedDiv(bridge->vars[2], 16*FRACUNIT); - bridge->vars[3] = bridge->vars[2]; - - // Start tag and end tag are TARGET SECTORS, not CONTROL SECTORS - // Control sector tags should be End_Tag + (End_Tag - Start_Tag) - bridge->vars[4] = sourceline->tag; // Start tag - bridge->vars[5] = (sides[sourceline->sidenum[0]].textureoffset>>FRACBITS); // End tag -} -*/ - /** * Adds a plane displacement thinker. * Whenever the "control" sector moves, @@ -6753,13 +6720,6 @@ void P_SpawnSpecials(boolean fromnetsave) } break; - case 65: // Bridge Thinker - /* - // Disable this until it's working right! - for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) - P_AddBridgeThinker(&lines[i], §ors[s]);*/ - break; - case 66: // Displace floor by front sector for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) P_AddPlaneDisplaceThinker(pd_floor, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); @@ -7287,7 +7247,7 @@ void P_SpawnSpecials(boolean fromnetsave) case 331: case 333: break; - + // Object dye executors case 334: case 336: diff --git a/src/p_spec.h b/src/p_spec.h index 6377059b6..d756f1942 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -354,7 +354,6 @@ void T_StartCrumble(elevator_t *elevator); void T_MarioBlock(levelspecthink_t *block); void T_SpikeSector(levelspecthink_t *spikes); void T_FloatSector(levelspecthink_t *floater); -void T_BridgeThinker(levelspecthink_t *bridge); void T_MarioBlockChecker(levelspecthink_t *block); void T_ThwompSector(levelspecthink_t *thwomp); void T_NoEnemiesSector(levelspecthink_t *nobaddies);