mirror of
https://github.com/nzp-team/glquake.git
synced 2025-03-14 06:34:18 +00:00
Remove more of the sbar, add more progs
This commit is contained in:
parent
85cb5b7992
commit
f12f8cf4ac
14 changed files with 406 additions and 1243 deletions
BIN
nzportable.3dsx
BIN
nzportable.3dsx
Binary file not shown.
BIN
nzportable.elf
BIN
nzportable.elf
Binary file not shown.
1
source/cl_hud.h
Normal file
1
source/cl_hud.h
Normal file
|
@ -0,0 +1 @@
|
|||
extern double HUD_Change_time;
|
|
@ -567,16 +567,6 @@ void CL_ParseClientdata (int bits)
|
|||
else
|
||||
cl.stats[STAT_WEAPONFRAME] = 0;
|
||||
|
||||
if (bits & SU_ARMOR)
|
||||
i = MSG_ReadByte ();
|
||||
else
|
||||
i = 0;
|
||||
if (cl.stats[STAT_ARMOR] != i)
|
||||
{
|
||||
cl.stats[STAT_ARMOR] = i;
|
||||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
if (bits & SU_WEAPON)
|
||||
i = MSG_ReadByte ();
|
||||
else
|
||||
|
@ -601,16 +591,21 @@ void CL_ParseClientdata (int bits)
|
|||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
for (i=0 ; i<4 ; i++)
|
||||
i = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_CURRENTMAG] != i)
|
||||
{
|
||||
j = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_SHELLS+i] != j)
|
||||
{
|
||||
cl.stats[STAT_SHELLS+i] = j;
|
||||
Sbar_Changed ();
|
||||
}
|
||||
HUD_Change_time = Sys_FloatTime() + 6;
|
||||
cl.stats[STAT_CURRENTMAG] = i;
|
||||
}
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_ROUNDS] != i)
|
||||
cl.stats[STAT_ROUNDS] = i;
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_ROUNDCHANGE] != i)
|
||||
cl.stats[STAT_ROUNDCHANGE] = i;
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
|
||||
if (standard_quake)
|
||||
|
|
|
@ -90,7 +90,7 @@ cvar_t scr_showturtle = {"showturtle","0"};
|
|||
cvar_t scr_showpause = {"showpause","1"};
|
||||
cvar_t scr_printspeed = {"scr_printspeed","8"};
|
||||
cvar_t scr_showfps = {"scr_showfps", "0"};
|
||||
|
||||
cvar_t scr_loadscreen = {"scr_loadscreen","1", qtrue};
|
||||
cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", true };
|
||||
|
||||
extern cvar_t crosshair;
|
||||
|
@ -1179,52 +1179,30 @@ void SCR_UpdateScreen (void)
|
|||
// do 3D refresh drawing, and then update the screen
|
||||
//
|
||||
SCR_SetUpToDrawConsole ();
|
||||
|
||||
|
||||
V_RenderView ();
|
||||
|
||||
GL_Set2D ();
|
||||
|
||||
//
|
||||
// draw any areas not covered by the refresh
|
||||
//
|
||||
SCR_TileClear ();
|
||||
// naievil -- fixme
|
||||
//Draw_Crosshair ();
|
||||
|
||||
if (scr_drawdialog)
|
||||
{
|
||||
Sbar_Draw ();
|
||||
Draw_FadeScreen ();
|
||||
SCR_DrawNotifyString ();
|
||||
scr_copyeverything = true;
|
||||
}
|
||||
else if (scr_drawloading)
|
||||
{
|
||||
SCR_DrawLoading ();
|
||||
Sbar_Draw ();
|
||||
}
|
||||
else if (cl.intermission == 1 && key_dest == key_game)
|
||||
{
|
||||
Sbar_IntermissionOverlay ();
|
||||
}
|
||||
else if (cl.intermission == 2 && key_dest == key_game)
|
||||
{
|
||||
Sbar_FinaleOverlay ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (crosshair.value)
|
||||
Draw_Character (scr_vrect.x + scr_vrect.width/2, scr_vrect.y + scr_vrect.height/2, '+');
|
||||
|
||||
SCR_DrawRam ();
|
||||
SCR_DrawNet ();
|
||||
SCR_DrawTurtle ();
|
||||
SCR_DrawPause ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
Sbar_Draw ();
|
||||
SCR_DrawFPS ();
|
||||
SCR_DrawConsole ();
|
||||
M_Draw ();
|
||||
}
|
||||
//muff - to show FPS on screen
|
||||
SCR_DrawFPS ();
|
||||
//SCR_DrawBAT (); //naievil -- fixme
|
||||
SCR_DrawPause ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
SCR_CheckDrawUseString ();
|
||||
//HUD_Draw (); // naievil -- fixme
|
||||
SCR_DrawConsole ();
|
||||
M_Draw ();
|
||||
|
||||
// naievil -- fixme
|
||||
//if(scr_loadscreen.value)
|
||||
// SCR_DrawLoadScreen();
|
||||
|
||||
// naievil -- fixme
|
||||
//Draw_LoadingFill();
|
||||
|
||||
V_UpdatePalette ();
|
||||
|
||||
|
|
|
@ -443,17 +443,6 @@ void Host_SavegameComment (char *text)
|
|||
{
|
||||
int i;
|
||||
char kills[20];
|
||||
|
||||
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
|
||||
text[i] = ' ';
|
||||
memcpy (text, cl.levelname, strlen(cl.levelname));
|
||||
sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
|
||||
memcpy (text+22, kills, strlen(kills));
|
||||
// convert space to _ to make stdio happy
|
||||
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
|
||||
if (text[i] == ' ')
|
||||
text[i] = '_';
|
||||
text[SAVEGAME_COMMENT_LENGTH] = '\0';
|
||||
}
|
||||
|
||||
|
||||
|
@ -1360,20 +1349,12 @@ void Host_Spawn_f (void)
|
|||
// send some stats
|
||||
//
|
||||
MSG_WriteByte (&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte (&host_client->message, STAT_TOTALSECRETS);
|
||||
MSG_WriteLong (&host_client->message, pr_global_struct->total_secrets);
|
||||
MSG_WriteByte (&host_client->message, STAT_ROUNDS);
|
||||
MSG_WriteByte (&host_client->message, pr_global_struct->rounds);
|
||||
|
||||
MSG_WriteByte (&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte (&host_client->message, STAT_TOTALMONSTERS);
|
||||
MSG_WriteLong (&host_client->message, pr_global_struct->total_monsters);
|
||||
|
||||
MSG_WriteByte (&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte (&host_client->message, STAT_SECRETS);
|
||||
MSG_WriteLong (&host_client->message, pr_global_struct->found_secrets);
|
||||
|
||||
MSG_WriteByte (&host_client->message, svc_updatestat);
|
||||
MSG_WriteByte (&host_client->message, STAT_MONSTERS);
|
||||
MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters);
|
||||
MSG_WriteByte (&host_client->message, STAT_ROUNDCHANGE);
|
||||
MSG_WriteByte (&host_client->message, pr_global_struct->rounds_change);
|
||||
|
||||
|
||||
//
|
||||
|
@ -1533,136 +1514,7 @@ void Host_Give_f (void)
|
|||
|
||||
switch (t[0])
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
// MED 01/04/97 added hipnotic give stuff
|
||||
if (hipnotic)
|
||||
{
|
||||
if (t[0] == '6')
|
||||
{
|
||||
if (t[1] == 'a')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
|
||||
else
|
||||
sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
|
||||
}
|
||||
else if (t[0] == '9')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
|
||||
else if (t[0] == '0')
|
||||
sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
|
||||
else if (t[0] >= '2')
|
||||
sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t[0] >= '2')
|
||||
sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_shells1");
|
||||
if (val)
|
||||
val->_float = v;
|
||||
}
|
||||
|
||||
sv_player->v.ammo_shells = v;
|
||||
break;
|
||||
case 'n':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_nails1");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon <= IT_LIGHTNING)
|
||||
sv_player->v.ammo_nails = v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.ammo_nails = v;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_lava_nails");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon > IT_LIGHTNING)
|
||||
sv_player->v.ammo_nails = v;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_rockets1");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon <= IT_LIGHTNING)
|
||||
sv_player->v.ammo_rockets = v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.ammo_rockets = v;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_multi_rockets");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon > IT_LIGHTNING)
|
||||
sv_player->v.ammo_rockets = v;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
sv_player->v.health = v;
|
||||
break;
|
||||
case 'c':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_cells1");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon <= IT_LIGHTNING)
|
||||
sv_player->v.ammo_cells = v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.ammo_cells = v;
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
if (rogue)
|
||||
{
|
||||
val = GetEdictFieldValue(sv_player, "ammo_plasma");
|
||||
if (val)
|
||||
{
|
||||
val->_float = v;
|
||||
if (sv_player->v.weapon > IT_LIGHTNING)
|
||||
sv_player->v.ammo_cells = v;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,8 +207,8 @@ void Key_Console (int key)
|
|||
{
|
||||
char *cmd;
|
||||
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
if (key == K_JOY3 || key == K_ENTER)
|
||||
{
|
||||
Cbuf_AddText (key_lines[edit_line]+1); // skip the >
|
||||
Cbuf_AddText ("\n");
|
||||
Con_Printf ("%s\n",key_lines[edit_line]);
|
||||
|
@ -219,6 +219,11 @@ void Key_Console (int key)
|
|||
if (cls.state == ca_disconnected)
|
||||
SCR_UpdateScreen (); // force an update, because the command
|
||||
// may take some time
|
||||
// for clientside cmds
|
||||
if (cls.state == ca_connected){
|
||||
pr_global_struct->CMD_STRING = (key_lines[edit_line-1]+1 - pr_strings);
|
||||
PR_ExecuteProgram (pr_global_struct->ParseClientCommand);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -977,6 +977,8 @@ void ED_LoadFromFile (char *data)
|
|||
}
|
||||
|
||||
|
||||
func_t EndFrame;
|
||||
|
||||
/*
|
||||
===============
|
||||
PR_LoadProgs
|
||||
|
@ -984,6 +986,7 @@ PR_LoadProgs
|
|||
*/
|
||||
void PR_LoadProgs (void)
|
||||
{
|
||||
dfunction_t *f;
|
||||
int i;
|
||||
|
||||
// flush the non-C variable lookup cache
|
||||
|
@ -1057,6 +1060,11 @@ void PR_LoadProgs (void)
|
|||
|
||||
for (i=0 ; i<progs->numglobals ; i++)
|
||||
((int *)pr_globals)[i] = LittleLong (((int *)pr_globals)[i]);
|
||||
|
||||
EndFrame = 0;
|
||||
|
||||
if ((f = ED_FindFunction ("EndFrame")) != NULL)
|
||||
EndFrame = (func_t)(f - pr_functions);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,10 +34,8 @@ typedef struct
|
|||
float coop;
|
||||
float teamplay;
|
||||
float serverflags;
|
||||
float total_secrets;
|
||||
float total_monsters;
|
||||
float found_secrets;
|
||||
float killed_monsters;
|
||||
float rounds;
|
||||
float rounds_change;
|
||||
float parm1;
|
||||
float parm2;
|
||||
float parm3;
|
||||
|
@ -69,6 +67,7 @@ typedef struct
|
|||
int msg_entity;
|
||||
func_t main;
|
||||
func_t StartFrame;
|
||||
func_t EndFrame;
|
||||
func_t PlayerPreThink;
|
||||
func_t PlayerPostThink;
|
||||
func_t ClientKill;
|
||||
|
@ -77,6 +76,9 @@ typedef struct
|
|||
func_t ClientDisconnect;
|
||||
func_t SetNewParms;
|
||||
func_t SetChangeParms;
|
||||
func_t ParseClientCommand;
|
||||
string_t CMD_STRING;
|
||||
func_t Soft_Restart;
|
||||
} globalvars_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -113,10 +115,7 @@ typedef struct
|
|||
string_t weaponmodel;
|
||||
float weaponframe;
|
||||
float currentammo;
|
||||
float ammo_shells;
|
||||
float ammo_nails;
|
||||
float ammo_rockets;
|
||||
float ammo_cells;
|
||||
float currentmag;
|
||||
float items;
|
||||
float takedamage;
|
||||
int chain;
|
||||
|
|
|
@ -122,21 +122,36 @@ void VID_UnlockBuffer (void);
|
|||
//
|
||||
#define MAX_CL_STATS 32
|
||||
#define STAT_HEALTH 0
|
||||
#define STAT_FRAGS 1
|
||||
#define STAT_points 1
|
||||
#define STAT_WEAPON 2
|
||||
#define STAT_AMMO 3
|
||||
#define STAT_ARMOR 4
|
||||
#define STAT_WEAPONFRAME 5
|
||||
#define STAT_SHELLS 6
|
||||
#define STAT_NAILS 7
|
||||
#define STAT_ROCKETS 8
|
||||
#define STAT_CELLS 9
|
||||
#define STAT_ACTIVEWEAPON 10
|
||||
#define STAT_TOTALSECRETS 11
|
||||
#define STAT_TOTALMONSTERS 12
|
||||
#define STAT_SECRETS 13 // bumped on client side by svc_foundsecret
|
||||
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
|
||||
|
||||
|
||||
#define STAT_CURRENTMAG 6
|
||||
#define STAT_ZOOM 7
|
||||
#define STAT_WEAPONSKIN 8
|
||||
#define STAT_ACTIVEWEAPON 10
|
||||
#define STAT_ROUNDS 11
|
||||
#define STAT_ROUNDCHANGE 12
|
||||
#define STAT_X2 13
|
||||
#define STAT_INSTA 14
|
||||
#define STAT_PRIGRENADES 15
|
||||
#define STAT_SECGRENADES 4
|
||||
#define STAT_GRENADES 9
|
||||
#define STAT_WEAPON2 17
|
||||
#define STAT_WEAPON2SKIN 18
|
||||
#define STAT_WEAPON2FRAME 19
|
||||
#define STAT_CURRENTMAG2 20
|
||||
|
||||
|
||||
// stock defines
|
||||
|
||||
#define IT_SHOTGUN 1
|
||||
|
@ -266,6 +281,8 @@ typedef struct
|
|||
#include "glquake.h"
|
||||
#endif
|
||||
|
||||
#include "cl_hud.h"
|
||||
|
||||
//=============================================================================
|
||||
|
||||
// the host system specifies the base of the directory tree, the
|
||||
|
@ -363,7 +380,7 @@ typedef struct
|
|||
extern waypoint_ai waypoints[MAX_WAYPOINTS];
|
||||
|
||||
|
||||
|
||||
extern func_t EndFrame;
|
||||
|
||||
|
||||
|
||||
|
|
999
source/sbar.c
999
source/sbar.c
File diff suppressed because it is too large
Load diff
|
@ -123,10 +123,8 @@ typedef struct client_s
|
|||
#define MOVETYPE_NOCLIP 8
|
||||
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
|
||||
#define MOVETYPE_BOUNCE 10
|
||||
#ifdef QUAKE2
|
||||
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
|
||||
#define MOVETYPE_FOLLOW 12 // track movement of aiment
|
||||
#endif
|
||||
|
||||
// edict->solid values
|
||||
#define SOLID_NOT 0 // no interaction with other objects
|
||||
|
|
|
@ -683,17 +683,15 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
|
||||
if (bits & SU_WEAPONFRAME)
|
||||
MSG_WriteByte (msg, ent->v.weaponframe);
|
||||
if (bits & SU_ARMOR)
|
||||
MSG_WriteByte (msg, ent->v.armorvalue);
|
||||
if (bits & SU_WEAPON)
|
||||
MSG_WriteByte (msg, SV_ModelIndex(pr_strings+ent->v.weaponmodel));
|
||||
|
||||
MSG_WriteShort (msg, ent->v.health);
|
||||
MSG_WriteByte (msg, ent->v.currentammo);
|
||||
MSG_WriteByte (msg, ent->v.ammo_shells);
|
||||
MSG_WriteByte (msg, ent->v.ammo_nails);
|
||||
MSG_WriteByte (msg, ent->v.ammo_rockets);
|
||||
MSG_WriteByte (msg, ent->v.ammo_cells);
|
||||
MSG_WriteByte (msg, ent->v.currentmag);
|
||||
|
||||
MSG_WriteByte (msg, pr_global_struct->rounds);
|
||||
MSG_WriteByte (msg, pr_global_struct->rounds_change);
|
||||
|
||||
if (standard_quake)
|
||||
{
|
||||
|
|
329
source/sv_phys.c
329
source/sv_phys.c
|
@ -1048,6 +1048,306 @@ void SV_WalkMove (edict_t *ent)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_Physics_Walk
|
||||
|
||||
Blubswillrule
|
||||
|
||||
A physics/velocity based walking method for monsters (zombies)
|
||||
|
||||
|
||||
The following functions are duplicates from player modified for use by monsters
|
||||
========================================================================================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
============
|
||||
SV_PushMonsterEntity
|
||||
|
||||
duplicate of SV_PushEntity: used for monster velocities.
|
||||
|
||||
Does not change the entities velocity at all
|
||||
============
|
||||
*/
|
||||
trace_t SV_PushMonsterEntity (edict_t *ent, vec3_t push)
|
||||
{
|
||||
trace_t trace;
|
||||
vec3_t end;
|
||||
|
||||
VectorAdd (ent->v.origin, push, end);
|
||||
|
||||
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent);
|
||||
|
||||
VectorCopy (trace.endpos, ent->v.origin);
|
||||
//SV_LinkEdict (ent, true); we don't need to link it here
|
||||
|
||||
if (trace.ent)
|
||||
SV_Impact (ent, trace.ent);
|
||||
|
||||
return trace;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
SV_MonsterWalkMove
|
||||
|
||||
duplicate SV_WalkMove: Only used by monsters who move by velocity
|
||||
======================
|
||||
*/
|
||||
void SV_MonsterWalkMove (edict_t *ent)
|
||||
{
|
||||
vec3_t upmove, downmove;
|
||||
vec3_t oldorg, oldvel;
|
||||
vec3_t nosteporg, nostepvel;
|
||||
int clip;
|
||||
trace_t steptrace, downtrace;
|
||||
|
||||
//
|
||||
// do a regular slide move unless it looks like you ran into a step
|
||||
//
|
||||
ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
|
||||
|
||||
VectorCopy (ent->v.origin, oldorg);
|
||||
VectorCopy (ent->v.velocity, oldvel);
|
||||
|
||||
clip = SV_FlyMove (ent, host_frametime, &steptrace);
|
||||
|
||||
if ( !(clip & 2) )
|
||||
return; // move didn't block on a step
|
||||
|
||||
//if (!oldonground && ent->v.waterlevel == 0)
|
||||
// return; // don't stair up while jumping
|
||||
|
||||
if (ent->v.movetype != MOVETYPE_WALK)
|
||||
return; // gibbed by a trigger
|
||||
|
||||
VectorCopy (ent->v.origin, nosteporg);
|
||||
VectorCopy (ent->v.velocity, nostepvel);
|
||||
//
|
||||
// try moving up and forward to go up a step
|
||||
//
|
||||
VectorCopy (oldorg, ent->v.origin); // back to start pos
|
||||
|
||||
VectorCopy (vec3_origin, upmove);
|
||||
VectorCopy (vec3_origin, downmove);
|
||||
upmove[2] = STEPSIZE;
|
||||
downmove[2] = -STEPSIZE + oldvel[2]*host_frametime;
|
||||
|
||||
// move up
|
||||
SV_PushMonsterEntity (ent, upmove); // FIXME: don't link?
|
||||
|
||||
// move forward
|
||||
ent->v.velocity[0] = oldvel[0];
|
||||
ent->v. velocity[1] = oldvel[1];
|
||||
ent->v. velocity[2] = 0;
|
||||
clip = SV_FlyMove (ent, host_frametime, &steptrace);
|
||||
|
||||
// check for stuckness, possibly due to the limited precision of floats
|
||||
// in the clipping hulls
|
||||
/*if (clip)
|
||||
{
|
||||
if ( fabsf(oldorg[1] - ent->v.origin[1]) < 0.03125 && fabsf(oldorg[0] - ent->v.origin[0]) < 0.03125 )
|
||||
{ // stepping up didn't make any progress
|
||||
clip = SV_TryUnstick (ent, oldvel);
|
||||
}
|
||||
}*/
|
||||
|
||||
// extra friction based on view angle
|
||||
if ( clip & 2 )
|
||||
SV_WallFriction (ent, &steptrace);
|
||||
|
||||
// move down
|
||||
downtrace = SV_PushMonsterEntity (ent, downmove); // FIXME: don't link?
|
||||
|
||||
if (downtrace.plane.normal[2] > 0.7)
|
||||
{
|
||||
if (downtrace.ent->v.solid == SOLID_BSP)
|
||||
{
|
||||
ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
|
||||
ent->v.groundentity = EDICT_TO_PROG(downtrace.ent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the push down didn't end up on good ground, use the move without
|
||||
// the step up. This happens near wall / slope combinations, and can
|
||||
// cause the player to hop up higher on a slope too steep to climb
|
||||
VectorCopy (nosteporg, ent->v.origin);
|
||||
VectorCopy (nostepvel, ent->v.velocity);
|
||||
}
|
||||
}
|
||||
|
||||
//Creating a duplicate SV_TestEntityPosition, one that does not check for monsters.
|
||||
//=============
|
||||
edict_t *SV_TestEntityPosition_NOMONSTERS(edict_t *ent)
|
||||
{
|
||||
trace_t trace;
|
||||
|
||||
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NOMONSTERS, ent);
|
||||
|
||||
if (trace.startsolid)
|
||||
return sv.edicts;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//=============
|
||||
//Creating a duplicate checkstuck that uses the above modified SV_TestEntityPosition_NOMONSTERS
|
||||
|
||||
//Also adds checking of the entities v.zoom value
|
||||
//1: used setorigin, so don't adjust for a collision
|
||||
//0: not in collision
|
||||
//=============
|
||||
|
||||
void SV_CheckStuck_IgnoreMonsters (edict_t *ent)
|
||||
{
|
||||
int i, j;
|
||||
int z;
|
||||
vec3_t org;
|
||||
|
||||
if (!SV_TestEntityPosition_NOMONSTERS(ent))
|
||||
{
|
||||
VectorCopy (ent->v.origin, ent->v.oldorigin);
|
||||
//ent->v.zoom = 0; // naievil -- fixme
|
||||
return;
|
||||
}
|
||||
|
||||
// naievil -- fixme
|
||||
//if(ent->v.zoom == 1)//if used setorigin
|
||||
//{
|
||||
// VectorCopy (ent->v.origin, ent->v.oldorigin);
|
||||
// return;//we don't care to adjust for stuckness, whoever used setorigin in qc better handle that
|
||||
//}
|
||||
VectorCopy (ent->v.origin, org);
|
||||
VectorCopy (ent->v.oldorigin, ent->v.origin);
|
||||
if (!SV_TestEntityPosition_NOMONSTERS(ent))
|
||||
{
|
||||
Con_DPrintf ("zombie unstuck from bsp hull or non-monster entity.\n");
|
||||
SV_LinkEdict (ent, true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (z=0 ; z< 18 ; z++)
|
||||
for (i=-1 ; i <= 1 ; i++)
|
||||
for (j=-1 ; j <= 1 ; j++)
|
||||
{
|
||||
ent->v.origin[0] = org[0] + i;
|
||||
ent->v.origin[1] = org[1] + j;
|
||||
ent->v.origin[2] = org[2] + z;
|
||||
if (!SV_TestEntityPosition_NOMONSTERS(ent))
|
||||
{
|
||||
Con_DPrintf ("zombie unstuck from bsp hull or non-monster entity.\n");
|
||||
SV_LinkEdict (ent, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VectorCopy (org, ent->v.origin);
|
||||
Con_DPrintf ("zombie is stuck in bsp hull or non-monster entity.\n");
|
||||
}
|
||||
//=============================
|
||||
//PushAwayZombies
|
||||
//blubswillrule
|
||||
//Makes sure zombies are not inside of each other
|
||||
//glorified version of PF_FindRadius
|
||||
//=============================
|
||||
void SV_PushAwayZombies(edict_t *ent)
|
||||
{
|
||||
edict_t *other_ent;
|
||||
float rad = 23;//approx. length of bbox corner
|
||||
float *org = ent->v.origin;
|
||||
vec3_t eorg;
|
||||
int i, j;
|
||||
|
||||
other_ent = NEXT_EDICT(sv.edicts);
|
||||
for (i=1 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(other_ent))
|
||||
{
|
||||
if (other_ent->free)
|
||||
continue;
|
||||
//if (ent->v.solid == SOLID_NOT)
|
||||
// continue;
|
||||
if( other_ent->v.solid != SOLID_SLIDEBOX)
|
||||
continue;
|
||||
if( other_ent->v.movetype != MOVETYPE_WALK)
|
||||
continue;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
eorg[j] = org[j] - (other_ent->v.origin[j] + (other_ent->v.mins[j] + other_ent->v.maxs[j])*0.5);
|
||||
if (Length(eorg) > rad)
|
||||
continue;
|
||||
|
||||
//Process nearby zombie
|
||||
for(j = 0; j < 2; j++)//only x & y
|
||||
other_ent->v.velocity[j] += (other_ent->v.origin[j] - ent->v.origin[j]) * 0.001;//push away other zombie
|
||||
//ent->v.velocity[j] += (ent->v.origin[j] - other_ent->v.origin[j]) * 0.01;//push away self
|
||||
}
|
||||
}
|
||||
//=============================
|
||||
|
||||
void SV_Physics_Walk(edict_t *ent)
|
||||
{
|
||||
//if (!SV_CheckWater (ent) && ! ((int)ent->v.flags & FL_WATERJUMP) )
|
||||
// SV_AddGravity (ent);
|
||||
//Slight modification of AddGravity below
|
||||
|
||||
//Zombie bbox is actually smaller, but the movement needs to pretend it is bigger
|
||||
vec3_t old_mins;
|
||||
vec3_t old_maxs;
|
||||
|
||||
if(!SV_RunThink(ent))
|
||||
return;
|
||||
|
||||
VectorCopy(ent->v.mins,old_mins);
|
||||
VectorCopy(ent->v.maxs,old_maxs);
|
||||
|
||||
//'-16,-16,-32', '16,16,40'
|
||||
ent->v.mins[0] = -16; ent->v.mins[1] = -16; ent->v.mins[2] = -32;
|
||||
ent->v.maxs[0] = 16; ent->v.maxs[1] = 16; ent->v.maxs[2] = 40;
|
||||
|
||||
//if (!((int)ent->v.flags & (FL_ONGROUND)))
|
||||
//{
|
||||
ent->v.velocity[2] -= 1.0 * sv_gravity.value * host_frametime;
|
||||
SV_CheckVelocity (ent);
|
||||
//}
|
||||
|
||||
//SV_CheckStuck_IgnoreMonsters(ent);
|
||||
//PushAwayZombies causes too high of a drop in framerate
|
||||
//SV_PushAwayZombies(ent);
|
||||
SV_MonsterWalkMove(ent);
|
||||
|
||||
|
||||
//checking for ground beneath us
|
||||
trace_t downtrace;
|
||||
vec3_t groundlocation;
|
||||
VectorCopy(ent->v.origin,groundlocation);
|
||||
groundlocation[2] = -STEPSIZE + ent->v.velocity[2]*host_frametime;
|
||||
|
||||
downtrace = SV_Move(ent->v.origin,ent->v.mins,ent->v.maxs,groundlocation, MOVE_NOMONSTERS,ent);
|
||||
|
||||
if(!downtrace.allsolid && !downtrace.startsolid)
|
||||
{
|
||||
VectorCopy (downtrace.endpos, ent->v.origin);
|
||||
|
||||
ent->v.flags = (int) ent->v.flags & ~FL_ONGROUND;
|
||||
if (downtrace.plane.normal[2] > 0.7)
|
||||
{
|
||||
if(downtrace.ent)
|
||||
{
|
||||
if (downtrace.ent->v.solid == SOLID_BSP)
|
||||
{
|
||||
ent->v.flags = (int) ent->v.flags | FL_ONGROUND;
|
||||
ent->v.groundentity = EDICT_TO_PROG(downtrace.ent);
|
||||
ent->v.velocity[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//restoring the bounding boxes
|
||||
VectorCopy(old_mins,ent->v.mins);
|
||||
VectorCopy(old_maxs,ent->v.maxs);
|
||||
|
||||
SV_LinkEdict(ent,true);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1145,7 +1445,6 @@ void SV_Physics_None (edict_t *ent)
|
|||
SV_RunThink (ent);
|
||||
}
|
||||
|
||||
#ifdef QUAKE2
|
||||
/*
|
||||
=============
|
||||
SV_Physics_Follow
|
||||
|
@ -1160,7 +1459,6 @@ void SV_Physics_Follow (edict_t *ent)
|
|||
VectorAdd (PROG_TO_EDICT(ent->v.aiment)->v.origin, ent->v.v_angle, ent->v.origin);
|
||||
SV_LinkEdict (ent, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=============
|
||||
|
@ -1453,11 +1751,6 @@ void SV_Physics_Step (edict_t *ent)
|
|||
}
|
||||
|
||||
SV_LinkEdict (ent, true);
|
||||
|
||||
if ((int)ent->v.flags & FL_ONGROUND)
|
||||
if (!wasonground)
|
||||
if (hitsound)
|
||||
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
|
||||
}
|
||||
|
||||
// regular thinking
|
||||
|
@ -1481,12 +1774,6 @@ void SV_Physics_Step (edict_t *ent)
|
|||
SV_CheckVelocity (ent);
|
||||
SV_FlyMove (ent, host_frametime, NULL);
|
||||
SV_LinkEdict (ent, true);
|
||||
|
||||
if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground
|
||||
{
|
||||
if (hitsound)
|
||||
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// regular thinking
|
||||
|
@ -1537,25 +1824,33 @@ void SV_Physics (void)
|
|||
SV_Physics_Pusher (ent);
|
||||
else if (ent->v.movetype == MOVETYPE_NONE)
|
||||
SV_Physics_None (ent);
|
||||
#ifdef QUAKE2
|
||||
else if (ent->v.movetype == MOVETYPE_FOLLOW)
|
||||
SV_Physics_Follow (ent);
|
||||
#endif
|
||||
else if(ent->v.movetype == MOVETYPE_WALK)
|
||||
SV_Physics_Walk(ent);
|
||||
else if (ent->v.movetype == MOVETYPE_NOCLIP)
|
||||
SV_Physics_Noclip (ent);
|
||||
else if (ent->v.movetype == MOVETYPE_STEP)
|
||||
SV_Physics_Step (ent);
|
||||
else if (ent->v.movetype == MOVETYPE_TOSS
|
||||
|| ent->v.movetype == MOVETYPE_BOUNCE
|
||||
#ifdef QUAKE2
|
||||
|| ent->v.movetype == MOVETYPE_BOUNCEMISSILE
|
||||
#endif
|
||||
|| ent->v.movetype == MOVETYPE_FLY
|
||||
|| ent->v.movetype == MOVETYPE_FLYMISSILE)
|
||||
SV_Physics_Toss (ent);
|
||||
else
|
||||
Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype);
|
||||
}
|
||||
|
||||
if (EndFrame)
|
||||
{
|
||||
// let the progs know that the frame has ended
|
||||
pr_global_struct->self = EDICT_TO_PROG(sv.edicts);
|
||||
pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
|
||||
pr_global_struct->time = sv.time;
|
||||
PR_ExecuteProgram (EndFrame);
|
||||
|
||||
}
|
||||
|
||||
if (pr_global_struct->force_retouch)
|
||||
pr_global_struct->force_retouch--;
|
||||
|
|
Loading…
Reference in a new issue