bool FCajunMaster::Move (AActor *actor, ticcmd_t *cmd) { fixed_t tryx, tryy; bool try_ok; int good; if (actor->movedir == DI_NODIR) return false; if ((unsigned)actor->movedir >= 8) I_Error ("Weird bot movedir!"); tryx = actor->x + 8*xspeed[actor->movedir]; tryy = actor->y + 8*yspeed[actor->movedir]; try_ok = CleanAhead (actor, tryx, tryy, cmd); if (!try_ok) //Anything blocking that could be opened etc.. { if (!spechit.Size ()) return false; actor->movedir = DI_NODIR; good = 0; line_t *ld; while (spechit.Pop (ld)) { bool tryit = true; if (ld->special == Door_LockedRaise && !P_CheckKeys (actor, ld->args[3], false)) tryit = false; else if (ld->special == Generic_Door && !P_CheckKeys (actor, ld->args[4], false)) tryit = false; if (tryit && (P_TestActivateLine (ld, actor, 0, SPAC_Use) || P_TestActivateLine (ld, actor, 0, SPAC_Push))) { good |= ld == actor->BlockingLine ? 1 : 2; } } if (good && ((pr_botopendoor() >= 203) ^ (good & 1))) { cmd->ucmd.buttons |= BT_USE; cmd->ucmd.forwardmove = FORWARDRUN; return true; } else return false; } else //Move forward. cmd->ucmd.forwardmove = FORWARDRUN; return true; }
bool P_PredictLine(line_t *line, AActor *mo, int side, int activationType) { int lineActivation; INTBOOL buttonSuccess; BYTE special; // Only predict a very specifc section of specials if (line->special != Teleport_Line && line->special != Teleport) { return false; } if (!P_TestActivateLine(line, mo, side, activationType) || !cl_predict_specials) { return false; } if (line->locknumber > 0) return false; lineActivation = line->activation; buttonSuccess = false; buttonSuccess = P_ExecuteSpecial(line->special, line, mo, side == 1, line->args[0], line->args[1], line->args[2], line->args[3], line->args[4]); special = line->special; // end of changed code if (developer && buttonSuccess) { Printf("Line special %d predicted on line %i\n", special, int(line - lines)); } return true; }
bool P_ActivateLine (line_t *line, AActor *mo, int side, int activationType, DVector3 *optpos) { int lineActivation; INTBOOL repeat; INTBOOL buttonSuccess; BYTE special; if (!P_TestActivateLine (line, mo, side, activationType, optpos)) { return false; } bool remote = (line->special != 7 && line->special != 8 && (line->special < 11 || line->special > 14)); if (line->locknumber > 0 && !P_CheckKeys (mo, line->locknumber, remote)) return false; lineActivation = line->activation; repeat = line->flags & ML_REPEAT_SPECIAL; buttonSuccess = false; buttonSuccess = P_ExecuteSpecial(line->special, line, mo, side == 1, line->args[0], line->args[1], line->args[2], line->args[3], line->args[4]); special = line->special; if (!repeat && buttonSuccess) { // clear the special on non-retriggerable lines line->special = 0; } if (buttonSuccess) { if (activationType == SPAC_Use || activationType == SPAC_Impact || activationType == SPAC_Push) { P_ChangeSwitchTexture (line->sidedef[0], repeat, special); } } // some old WADs use this method to create walls that change the texture when shot. else if (activationType == SPAC_Impact && // only for shootable triggers (level.flags2 & LEVEL2_DUMMYSWITCHES) && // this is only a compatibility setting for an old hack! !repeat && // only non-repeatable triggers (special<Generic_Floor || special>Generic_Crusher) && // not for Boom's generalized linedefs special && // not for lines without a special tagManager.LineHasID(line, line->args[0]) && // Safety check: exclude edited UDMF linedefs or ones that don't map the tag to args[0] line->args[0] && // only if there's a tag (which is stored in the first arg) P_FindFirstSectorFromTag (line->args[0]) == -1) // only if no sector is tagged to this linedef { P_ChangeSwitchTexture (line->sidedef[0], repeat, special); line->special = 0; } // end of changed code if (developer && buttonSuccess) { Printf ("Line special %d activated on line %i\n", special, int(line - lines)); } return true; }