-
关注Ta
-
- 注册时间 2007-01-11
- 最后登录 2019-10-27
-
- 发帖447
- 在线117小时
- 精华6
- DB19221
- 威望208
- 保证金0
- 桃子0
- 鲜花0
- 鸡蛋0
-
访问TA的空间加好友用道具
|
—
本帖被 步惊天 执行加亮操作(2007-09-02)
—
如果风格不公开MAX 的, 就它最强了 - Some comments would be nice, enjoy
- Code:
- /*
- Walkbot v1.5
- Author: CrazyLord
- File: walkbot.cpp
- Credits: OGC Team
- Contact: Unknowncheats.com forum (PM)
- */
- #include <vector>
- #include "client.h"
- #include "engine/cl_entity.h"
- #include "calcscreen.h"
- #include "walkbot.h"
- WalkBot wBot;
- void WalkBot::addWaypoint(vec3_t input) {
- waypoint wTemp;
- VectorCopy(input,wTemp.origin);
- wPoints.push_back(wTemp);
- }
- void WalkBot::adjustWaypoint(int ID, float x, float y, float z) {
- wPoints[ID].origin[0] = x;
- wPoints[ID].origin[1] = y;
- wPoints[ID].origin[2] = z;
- }
- bool WalkBot::wBotMeIsinRadius(int ID) {
- if ((me.ent->origin[0] <= (wPoints[ID].origin[0] + cvar.walkbot_radius)) &&
- (me.ent->origin[0] >= (wPoints[ID].origin[0] - cvar.walkbot_radius)) &&
- (me.ent->origin[1] <= (wPoints[ID].origin[1] + cvar.walkbot_radius)) &&
- (me.ent->origin[1] >= (wPoints[ID].origin[1] - cvar.walkbot_radius))) {
- return true;
- }
- else
- return false;
- }
- void WalkBot::wBotDraw() {
- float vecScreen[2];
- for (int i = 0;i < wBot.wPoints.size();i++) {
- if (wPoints.visible) {
- if (NewCalcScreen(wBot.wPoints.origin, vecScreen)) {
- if (wBot.wPoints.visible) {
- DrawHudStringCenter(vecScreen[0]+(cvar.walkbot_draw_w/2), vecScreen[1]-20, 0, 255, 0, "ID: %i",i);
- gEngfuncs.pfnFillRGBA(vecScreen[0], vecScreen[1], cvar.walkbot_draw_w, cvar.walkbot_draw_h, 0, 255, 0, 255);
- }
- else if (!wBot.wPoints.visible) {
- DrawHudStringCenter(vecScreen[0]+(cvar.walkbot_draw_w/2), vecScreen[1]-20, 255, 0, 0, "ID: %i",i);
- gEngfuncs.pfnFillRGBA(vecScreen[0], vecScreen[1], cvar.walkbot_draw_w, cvar.walkbot_draw_h, 255, 0, 0, 255);
- }
- }
- }
- }
- }
- void WalkBot::wBotVisibility() {
- for (int i = 0;i < wBot.wPoints.size();i++)
- wBot.wBotCheckVisibility(i);
- }
- void WalkBot::wBotCheckVisibility(int ID) {
- vec3_t wTemp, wOutput, forward, right, up;
- VectorCopy(wPoints[ID].origin, wOutput);
- wTemp[0] = 0.0f;
- wTemp[1] = wPoints[ID].origin[1];
- wTemp[2] = 0.0f;
- gEngfuncs.pfnAngleVectors(wTemp, forward, right, up);
- wTemp[2] = -wTemp[2];
- wOutput[0] = wOutput[0] + forward[0] + up[0] + right[0];
- wOutput[1] = wOutput[1] + forward[1] + up[1] + right[1];
- wOutput[2] = wOutput[2] + forward[2] + up[2] + right[2];
- if (PathFree(me.pmEyePos, wOutput))
- wPoints[ID].visible = true;
- else {
- wPoints[ID].visible = false;
- if (target != -1) {
- if (ID == target)
- wBotSelectWaypoint();
- }
- }
- }
- void WalkBot::wBotSelectWaypoint() {
- target = oldtarget;
- if (target == -1)
- target = 0;
- else if (target == wPoints.size() - 1) {
- if (wBotMeIsinRadius(target)) {
- target = -1;
- wBot.onSwitch = false;
- }
- }
- else if (wBotMeIsinRadius(target) && !wPoints[target].hasBeenUsed && wPoints[target].visible) {
- wPoints[target].hasBeenUsed = true;
- target++;
- }
- else if (!wPoints[target].visible) {
- wPoints[target].hasBeenUsed = false;
- target--;
- }
- oldtarget = target;
- }
- void WalkBot::wBotCalculateAimingSpot() {
- vec3_t wTemp, wTempOutput, forward, right, up;
- VectorCopy(wPoints[target].origin, wTempOutput);
- wTemp[0] = 0.0f;
- wTemp[1] = wPoints[target].origin[1];
- wTemp[2] = 0.0f;
- gEngfuncs.pfnAngleVectors(wTemp, forward, right, up);
- wTempOutput[0] = wTempOutput[0] + forward[0] + up[0] + right[0] - me.pmEyePos[0];
- wTempOutput[1] = wTempOutput[1] + forward[1] + up[1] + right[1] - me.pmEyePos[1];
- wTempOutput[2] = wTempOutput[2] + forward[2] + up[2] + right[2] - me.pmEyePos[2];
- VectorAngles(wTempOutput, wBotAimingSpot);
- wBotAimingSpot[0] = 0.0f;
- if (wBotAimingSpot[1] > 180)
- wBotAimingSpot[1] -= 360;
- }
|