faster inits and casting logic to float doesn't seem to work well atm.

This commit is contained in:
Bill Currie 2003-02-21 06:01:33 +00:00
parent bedcb0d64f
commit 6503dc6c16
3 changed files with 12 additions and 8 deletions

View file

@ -77,7 +77,7 @@ float(entity e) bot_size_player =
void() bot_dodge_stuff = void() bot_dodge_stuff =
{ {
local entity foe; local entity foe;
local float foedist, avdist, scandist = 0, foesz, flen, tsz; local float foedist, avdist, foesz, flen, tsz;
local vector v; local vector v;
if (waypoint_mode > WM_LOADED) if (waypoint_mode > WM_LOADED)

View file

@ -149,7 +149,7 @@ manuever around.
void(vector whichway, float danger) frik_obstructed = void(vector whichway, float danger) frik_obstructed =
{ {
local float dist; local float dist;
local vector disway = '0 0 0', org; local vector disway, org;
// TODO: something // TODO: something
if (self.b_aiflags & AI_BLIND) if (self.b_aiflags & AI_BLIND)
return; return;
@ -179,10 +179,11 @@ void(vector whichway, float danger) frik_obstructed =
self.obs_dir = whichway; self.obs_dir = whichway;
disway_x = whichway_y * -1; disway_x = whichway_y * -1;
disway_y = whichway_x; disway_y = whichway_x;
disway_z = 0;
dist = vlen(org - (self.origin + disway)); dist = vlen(org - (self.origin + disway));
disway_x = whichway_y; disway_x = whichway_y;
disway_y = whichway_x * -1; disway_y = whichway_x * -1;
self.wallhug = (float) (vlen(org - (self.origin + disway)) > dist); self.wallhug = (vlen(org - (self.origin + disway)) > dist) ? 1.0 : 0.0;
self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED; self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
} }
@ -190,10 +191,11 @@ void(vector whichway, float danger) frik_obstructed =
{ {
disway_x = whichway_y * -1; disway_x = whichway_y * -1;
disway_y = whichway_x; disway_y = whichway_x;
disway_z = 0;
dist = vlen(disway - self.obs_dir); dist = vlen(disway - self.obs_dir);
disway_x = whichway_y; disway_x = whichway_y;
disway_y = whichway_x * -1; disway_y = whichway_x * -1;
self.wallhug = (float) (vlen(disway - self.obs_dir) < dist); self.wallhug = (vlen(disway - self.obs_dir) < dist) ? 1.0 : 0.0;
self.obs_dir = whichway; self.obs_dir = whichway;
self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED; self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
@ -348,7 +350,7 @@ I have no idea how well it will work
void() frik_dodge_obstruction = void() frik_dodge_obstruction =
{ {
local vector way = '0 0 0', org; local vector way, org;
local float oflags, yaw; local float oflags, yaw;
if (!(self.b_aiflags & AI_OBSTRUCTED)) if (!(self.b_aiflags & AI_OBSTRUCTED))
@ -385,6 +387,7 @@ void() frik_dodge_obstruction =
way_x = self.obs_dir_y; way_x = self.obs_dir_y;
way_y = self.obs_dir_x * -1; way_y = self.obs_dir_x * -1;
} }
way_z = 0;
self.keys = self.keys & 960 + frik_KeysForDir(way); self.keys = self.keys & 960 + frik_KeysForDir(way);
} }

View file

@ -56,13 +56,13 @@ Stuff mimicking cl_input.c code
*/ */
float(float key) CL_KeyState = float(float key) CL_KeyState =
{ {
return (float)((self.keys & key) > 0); return ((self.keys & key) > 0) ? 1.0 : 0.0;
}; };
void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles
{ {
local float anglespeed; local float anglespeed;
local vector view = '0 0 0'; local vector view;
if (self.keys != self.oldkeys) if (self.keys != self.oldkeys)
{ {
self.movevect = '0 0 0'; self.movevect = '0 0 0';
@ -101,6 +101,7 @@ void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles
{ {
view_x = angcomp(self.b_angle_x, self.v_angle_x); view_x = angcomp(self.b_angle_x, self.v_angle_x);
view_y = angcomp(self.b_angle_y, self.v_angle_y); view_y = angcomp(self.b_angle_y, self.v_angle_y);
view_z = 0;
if (vlen(view) > 30) if (vlen(view) > 30)
{ {
self.mouse_emu = self.mouse_emu + (view * 30); self.mouse_emu = self.mouse_emu + (view * 30);
@ -392,7 +393,7 @@ float() SV_CheckWater =
self.waterlevel = 3; self.waterlevel = 3;
} }
} }
return (float) (self.waterlevel > 1); return (self.waterlevel > 1) ? 1.0 : 0.0;
}; };
void() RemoveThud = // well sometimes void() RemoveThud = // well sometimes