mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-10 06:31:35 +00:00
Fix movement speeds, aimsnap, zoom, Draw_ColorPic, FOV, maxspeed
This commit is contained in:
parent
b6405841b9
commit
02eb7ad820
24 changed files with 927 additions and 125 deletions
BIN
nzportable.3dsx
BIN
nzportable.3dsx
Binary file not shown.
BIN
nzportable.elf
BIN
nzportable.elf
Binary file not shown.
|
@ -90,7 +90,6 @@ typedef struct
|
|||
|
||||
point_change_t point_change[10];
|
||||
|
||||
#if 0
|
||||
/*
|
||||
===============
|
||||
HUD_Init
|
||||
|
@ -146,9 +145,11 @@ void HUD_Init (void)
|
|||
fx_blood_ld = Draw_CachePic ("gfx/hud/blood_bl");
|
||||
fx_blood_rd = Draw_CachePic ("gfx/hud/blood_br");*/
|
||||
|
||||
Achievement_Init();
|
||||
// naievil -- fixme
|
||||
//Achievement_Init();
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
===============
|
||||
HUD_NewMap
|
||||
|
@ -448,7 +449,7 @@ void HUD_Point_Change (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -468,11 +469,7 @@ void HUD_Blood (void)
|
|||
if (alpha <= 0.0)
|
||||
return;
|
||||
|
||||
#ifdef PSP_VFPU
|
||||
float modifier = (vfpu_sinf(cl.time * 10) * 20) - 20;//always negative
|
||||
#else
|
||||
float modifier = (sin(cl.time * 10) * 20) - 20;//always negative
|
||||
#endif
|
||||
|
||||
if(modifier < -35.0)
|
||||
modifier = -35.0;
|
||||
|
@ -489,7 +486,7 @@ void HUD_Blood (void)
|
|||
Draw_ColorPic (vid.width - fx_blood_ru->width, 0, fx_blood_ru, 82, 6, 6, alpha);
|
||||
Draw_ColorPic (vid.width - fx_blood_ru->width, vid.height - fx_blood_ru->height, fx_blood_rd, 82, 6, 6, alpha);*/
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
===============
|
||||
HUD_GetWorldText
|
||||
|
@ -1362,6 +1359,7 @@ void HUD_Weapon (void)
|
|||
x_value = vid.width - 8 - l*8;
|
||||
Draw_String (x_value, y_value, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -1373,9 +1371,8 @@ void HUD_Draw (void)
|
|||
if (scr_con_current == vid.height)
|
||||
return; // console is full screen
|
||||
|
||||
// naievil -- fixme
|
||||
//if (key_dest == key_menu_pause)
|
||||
// return;
|
||||
if (key_dest == key_menu_pause)
|
||||
return;
|
||||
|
||||
scr_copyeverything = 1;
|
||||
|
||||
|
@ -1391,45 +1388,34 @@ void HUD_Draw (void)
|
|||
Draw_String (vid.width - 304, 48, "Press reload to make special waypoint");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (cl.stats[STAT_HEALTH] <= 0)
|
||||
{
|
||||
HUD_EndScreen ();
|
||||
return;
|
||||
}
|
||||
|
||||
HUD_Blood();
|
||||
HUD_Rounds();
|
||||
HUD_Perks();
|
||||
HUD_Powerups();
|
||||
HUD_ProgressBar();
|
||||
if ((HUD_Change_time > Sys_FloatTime() || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG] || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) && cl.stats[STAT_HEALTH] >= 20)
|
||||
{ //these elements are only drawn when relevant for few seconds
|
||||
HUD_Ammo();
|
||||
HUD_Grenades();
|
||||
HUD_Weapon();
|
||||
HUD_AmmoString();
|
||||
}
|
||||
HUD_Points();
|
||||
HUD_Point_Change();
|
||||
HUD_Achievement();
|
||||
|
||||
if (domaxammo == true) {
|
||||
if (maxammoopac <= 0) {
|
||||
maxammoopac = 255;
|
||||
maxammoy = 250;
|
||||
}
|
||||
HUD_MaxAmmo();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void HUD_Draw (void)
|
||||
{
|
||||
// naievil -- just a test hud to draw things, why does this break the physical device build?
|
||||
//char test[256];
|
||||
//sprintf (test,"Weapon: %s", pr_strings+sv_player->v.weaponmodel);
|
||||
//Draw_String (0, 8, test);
|
||||
|
||||
}
|
||||
*/
|
||||
// HUD_Blood();
|
||||
// HUD_Rounds();
|
||||
// HUD_Perks();
|
||||
// HUD_Powerups();
|
||||
// HUD_ProgressBar();
|
||||
// if ((HUD_Change_time > Sys_FloatTime() || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG] || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) && cl.stats[STAT_HEALTH] >= 20)
|
||||
// { //these elements are only drawn when relevant for few seconds
|
||||
// HUD_Ammo();
|
||||
// HUD_Grenades();
|
||||
// HUD_Weapon();
|
||||
// HUD_AmmoString();
|
||||
// }
|
||||
// HUD_Points();
|
||||
// HUD_Point_Change();
|
||||
// HUD_Achievement();
|
||||
//
|
||||
// if (domaxammo == true) {
|
||||
// if (maxammoopac <= 0) {
|
||||
// maxammoopac = 255;
|
||||
// maxammoy = 250;
|
||||
// }
|
||||
// HUD_MaxAmmo();
|
||||
// }
|
||||
}
|
|
@ -1 +1,2 @@
|
|||
extern double HUD_Change_time;
|
||||
void HUD_Init (void);
|
|
@ -46,10 +46,10 @@ state bit 2 is edge triggered on the down to up transition
|
|||
*/
|
||||
|
||||
|
||||
kbutton_t in_mlook, in_klook;
|
||||
kbutton_t in_klook;//Heffo - mlook cvar
|
||||
kbutton_t in_left, in_right, in_forward, in_back;
|
||||
kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
|
||||
kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack;
|
||||
kbutton_t in_strafe, in_speed, in_use, in_jump, in_attack, in_grenade, in_reload, in_switch, in_knife, in_aim;
|
||||
kbutton_t in_up, in_down;
|
||||
|
||||
int in_impulse;
|
||||
|
@ -114,14 +114,18 @@ void KeyUp (kbutton_t *b)
|
|||
b->state |= 4; // impulse up
|
||||
}
|
||||
|
||||
qboolean croshhairmoving = false;
|
||||
|
||||
void IN_KLookDown (void) {KeyDown(&in_klook);}
|
||||
void IN_KLookUp (void) {KeyUp(&in_klook);}
|
||||
/*
|
||||
void IN_MLookDown (void) {KeyDown(&in_mlook);}
|
||||
void IN_MLookUp (void) {
|
||||
KeyUp(&in_mlook);
|
||||
if ( !(in_mlook.state&1) && lookspring.value)
|
||||
V_StartPitchDrift();
|
||||
}
|
||||
*/
|
||||
void IN_UpDown(void) {KeyDown(&in_up);}
|
||||
void IN_UpUp(void) {KeyUp(&in_up);}
|
||||
void IN_DownDown(void) {KeyDown(&in_down);}
|
||||
|
@ -155,6 +159,16 @@ void IN_UseDown (void) {KeyDown(&in_use);}
|
|||
void IN_UseUp (void) {KeyUp(&in_use);}
|
||||
void IN_JumpDown (void) {KeyDown(&in_jump);}
|
||||
void IN_JumpUp (void) {KeyUp(&in_jump);}
|
||||
void IN_GrenadeDown (void) {KeyDown(&in_grenade);}
|
||||
void IN_GrenadeUp (void) {KeyUp(&in_grenade);}
|
||||
void IN_SwitchDown (void) {KeyDown(&in_switch);}
|
||||
void IN_SwitchUp (void) {KeyUp(&in_switch);}
|
||||
void IN_ReloadDown (void) {KeyDown(&in_reload);}
|
||||
void IN_ReloadUp (void) {KeyUp(&in_reload);}
|
||||
void IN_KnifeDown (void) {KeyDown(&in_knife);}
|
||||
void IN_KnifeUp (void) {KeyUp(&in_knife);}
|
||||
void IN_AimDown (void) {KeyDown(&in_aim);}
|
||||
void IN_AimUp (void) {KeyUp(&in_aim);}
|
||||
|
||||
void IN_Impulse (void) {in_impulse=Q_atoi(Cmd_Argv(1));}
|
||||
|
||||
|
@ -178,26 +192,34 @@ float CL_KeyState (kbutton_t *key)
|
|||
down = key->state & 1;
|
||||
val = 0;
|
||||
|
||||
if (impulsedown && !impulseup)
|
||||
if (impulsedown && !impulseup)
|
||||
{
|
||||
if (down)
|
||||
val = 0.5; // pressed and held this frame
|
||||
else
|
||||
val = 0; // I_Error ();
|
||||
}
|
||||
if (impulseup && !impulsedown)
|
||||
{
|
||||
if (down)
|
||||
val = 0; // I_Error ();
|
||||
else
|
||||
val = 0; // released this frame
|
||||
}
|
||||
if (!impulsedown && !impulseup)
|
||||
{
|
||||
if (down)
|
||||
val = 1.0; // held the entire frame
|
||||
else
|
||||
val = 0; // up the entire frame
|
||||
}
|
||||
if (impulsedown && impulseup)
|
||||
{
|
||||
if (down)
|
||||
val = 0.75; // released and re-pressed this frame
|
||||
else
|
||||
val = 0.25; // pressed and released this frame
|
||||
}
|
||||
|
||||
key->state &= 1; // clear impulses
|
||||
|
||||
|
@ -210,9 +232,9 @@ float CL_KeyState (kbutton_t *key)
|
|||
//==========================================================================
|
||||
|
||||
cvar_t cl_upspeed = {"cl_upspeed","200"};
|
||||
cvar_t cl_forwardspeed = {"cl_forwardspeed","200", true};
|
||||
cvar_t cl_backspeed = {"cl_backspeed","200", true};
|
||||
cvar_t cl_sidespeed = {"cl_sidespeed","350"};
|
||||
float cl_forwardspeed;
|
||||
float cl_backspeed;
|
||||
float cl_sidespeed;
|
||||
|
||||
cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0"};
|
||||
|
||||
|
@ -221,6 +243,11 @@ cvar_t cl_pitchspeed = {"cl_pitchspeed","150"};
|
|||
|
||||
cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5"};
|
||||
|
||||
cvar_t in_mlook = {"in_mlook", "1", true}; //Heffo - mlook cvar
|
||||
cvar_t in_aimassist = {"in_aimassist", "1", true};
|
||||
|
||||
//Shpuld - Porting over lower sens for lower fov
|
||||
extern cvar_t scr_fov;
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -229,16 +256,23 @@ CL_AdjustAngles
|
|||
Moves the local angle positions
|
||||
================
|
||||
*/
|
||||
extern int original_fov, final_fov;
|
||||
void CL_AdjustAngles (void)
|
||||
{
|
||||
float speed;
|
||||
float up, down;
|
||||
|
||||
|
||||
if (in_speed.state & 1)
|
||||
speed = host_frametime * cl_anglespeedkey.value;
|
||||
else
|
||||
speed = host_frametime;
|
||||
|
||||
//shpuld begin
|
||||
speed = speed * scr_fov.value/90;
|
||||
//speed = speed*final_fov/original_fov;
|
||||
//shpuld end
|
||||
|
||||
|
||||
if (!(in_strafe.state & 1))
|
||||
{
|
||||
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
|
||||
|
@ -251,16 +285,16 @@ void CL_AdjustAngles (void)
|
|||
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
|
||||
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
|
||||
}
|
||||
|
||||
|
||||
up = CL_KeyState (&in_lookup);
|
||||
down = CL_KeyState(&in_lookdown);
|
||||
|
||||
|
||||
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
|
||||
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
|
||||
|
||||
if (up || down)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
if (cl.viewangles[PITCH] < -70)
|
||||
|
@ -270,7 +304,7 @@ void CL_AdjustAngles (void)
|
|||
cl.viewangles[ROLL] = 50;
|
||||
if (cl.viewangles[ROLL] < -50)
|
||||
cl.viewangles[ROLL] = -50;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -280,32 +314,50 @@ CL_BaseMove
|
|||
Send the intended movement message to the server
|
||||
================
|
||||
*/
|
||||
extern cvar_t waypoint_mode;
|
||||
float crosshair_opacity;
|
||||
void CL_BaseMove (usercmd_t *cmd)
|
||||
{
|
||||
if (cls.signon != SIGNONS)
|
||||
if (cls.signon != SIGNONS)//BLUBS CHANGED HERE
|
||||
return;
|
||||
|
||||
|
||||
CL_AdjustAngles ();
|
||||
|
||||
|
||||
Q_memset (cmd, 0, sizeof(*cmd));
|
||||
|
||||
// Moto - we handle movespeed in QC now.
|
||||
cl_backspeed = cl_forwardspeed = cl_sidespeed = sv_player->v.maxspeed;
|
||||
|
||||
// Throttle side and back speeds
|
||||
cl_sidespeed *= 0.8;
|
||||
cl_backspeed *= 0.7;
|
||||
|
||||
if (waypoint_mode.value)
|
||||
cl_backspeed = cl_forwardspeed = cl_sidespeed *= 1.5;
|
||||
|
||||
if (in_strafe.state & 1)
|
||||
{
|
||||
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
|
||||
cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_left);
|
||||
cmd->sidemove += cl_sidespeed * CL_KeyState (&in_right);
|
||||
cmd->sidemove -= cl_sidespeed * CL_KeyState (&in_left);
|
||||
}
|
||||
|
||||
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_moveright);
|
||||
cmd->sidemove -= cl_sidespeed.value * CL_KeyState (&in_moveleft);
|
||||
// crosshair stuff
|
||||
croshhairmoving = true;
|
||||
crosshair_opacity -= 8;
|
||||
if (crosshair_opacity <= 128)
|
||||
crosshair_opacity = 128;
|
||||
|
||||
cmd->sidemove += cl_sidespeed * CL_KeyState (&in_moveright);
|
||||
cmd->sidemove -= cl_sidespeed * CL_KeyState (&in_moveleft);
|
||||
|
||||
cmd->upmove += cl_upspeed.value * CL_KeyState (&in_up);
|
||||
cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);
|
||||
|
||||
if (! (in_klook.state & 1) )
|
||||
{
|
||||
cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
|
||||
cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
|
||||
}
|
||||
{
|
||||
cmd->forwardmove += cl_forwardspeed * CL_KeyState (&in_forward);
|
||||
cmd->forwardmove -= cl_backspeed * CL_KeyState (&in_back);
|
||||
}
|
||||
|
||||
//
|
||||
// adjust for speed key
|
||||
|
@ -317,11 +369,131 @@ void CL_BaseMove (usercmd_t *cmd)
|
|||
cmd->upmove *= cl_movespeedkey.value;
|
||||
}
|
||||
|
||||
#ifdef QUAKE2
|
||||
cmd->lightlevel = cl.light_level;
|
||||
#endif
|
||||
// reset crosshair
|
||||
if (!CL_KeyState (&in_moveright) && !CL_KeyState (&in_moveleft) && !CL_KeyState (&in_forward) && !CL_KeyState (&in_back)) {
|
||||
croshhairmoving = false;
|
||||
|
||||
crosshair_opacity += 22;
|
||||
|
||||
if (crosshair_opacity >= 255)
|
||||
crosshair_opacity = 255;
|
||||
}
|
||||
}
|
||||
|
||||
int infront(edict_t *ent1, edict_t *ent2)
|
||||
{
|
||||
vec3_t vec;
|
||||
float dot;
|
||||
VectorSubtract(ent2->v.origin,ent1->v.origin,vec);
|
||||
VectorNormalize(vec);
|
||||
|
||||
vec3_t temp_angle,temp_forward,temp_right,temp_up;
|
||||
VectorCopy(cl.viewangles,temp_angle);
|
||||
|
||||
AngleVectors(temp_angle,temp_forward,temp_right,temp_up);
|
||||
|
||||
dot = DotProduct(vec,temp_forward);
|
||||
if(dot > 0.98)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EN_Find(int num,char *string)
|
||||
{
|
||||
edict_t *ed;
|
||||
|
||||
int e;
|
||||
e = num;
|
||||
|
||||
for(e++; e < sv.num_edicts; e++)
|
||||
{
|
||||
ed = EDICT_NUM(e);
|
||||
if(ed->free)
|
||||
continue;
|
||||
if(!strcmp(pr_strings + ed->v.classname,string))
|
||||
{
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CL_Aim_Snap(void)
|
||||
{
|
||||
edict_t *z,*bz,*player;
|
||||
int znum;
|
||||
trace_t trace;
|
||||
float bestDist = 10000;
|
||||
vec3_t distVec, zOrg, pOrg;
|
||||
//32 is v_ofs num
|
||||
|
||||
bz = sv.edicts;
|
||||
|
||||
int vofs = 32;//32 is actual v_ofs num
|
||||
int aimOfs = -10;//30 is top of bbox, 20 is our goal, so -10
|
||||
//Zombie body bbox vert max = 30
|
||||
//20 is the offset of the height of the zombie that we're aiming at, 20 above the origin
|
||||
//Crawler body bbox vert max = -15
|
||||
|
||||
//Equation = origin + bbox vertical offset - 20
|
||||
|
||||
player = EDICT_NUM(cl.viewentity);
|
||||
VectorCopy(player->v.origin,pOrg);
|
||||
pOrg[2] += vofs;
|
||||
|
||||
if (cl.perks & 64)
|
||||
znum = EN_Find(0,"ai_zombie_head");
|
||||
else
|
||||
znum = EN_Find(0,"ai_zombie");
|
||||
|
||||
z = EDICT_NUM(znum);
|
||||
VectorCopy(z->v.origin,zOrg);
|
||||
zOrg[2] += z->v.maxs[2];//Setting to top of zomb ent
|
||||
zOrg[2] += aimOfs;
|
||||
|
||||
while(znum != 0)
|
||||
{
|
||||
if((z->v.health > 0) && infront(player,z))
|
||||
{
|
||||
VectorCopy(z->v.origin,zOrg);
|
||||
zOrg[2] += aimOfs;
|
||||
VectorSubtract(pOrg,zOrg,distVec);
|
||||
if(VectorLength(distVec) < bestDist)
|
||||
{
|
||||
trace = SV_Move (pOrg, vec3_origin, vec3_origin,zOrg, 1, player);
|
||||
if (trace.fraction >= 1)
|
||||
{
|
||||
bestDist = VectorLength(distVec);
|
||||
bz = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cl.perks & 64)
|
||||
znum = EN_Find(znum,"ai_zombie_head");
|
||||
else
|
||||
znum = EN_Find(znum,"ai_zombie");
|
||||
z = EDICT_NUM(znum);
|
||||
}
|
||||
|
||||
if(bz != sv.edicts)
|
||||
{
|
||||
VectorCopy(bz->v.origin,zOrg);
|
||||
zOrg[2] += bz->v.maxs[2];//Setting to top of bbox
|
||||
zOrg[2] += aimOfs;
|
||||
VectorSubtract(zOrg,pOrg,distVec);
|
||||
VectorNormalize(distVec);
|
||||
vectoangles(distVec,distVec);
|
||||
distVec[0] += (distVec[0] > 180)? -360 : 0;//Need to bound pitch around 0, from -180, to + 180
|
||||
distVec[0] *= -1;//inverting pitch
|
||||
|
||||
if(distVec[0] < -70 || distVec[0] > 80)
|
||||
return;
|
||||
|
||||
VectorCopy(distVec,cl.viewangles);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -329,6 +501,9 @@ void CL_BaseMove (usercmd_t *cmd)
|
|||
CL_SendMove
|
||||
==============
|
||||
*/
|
||||
int zoom_snap;
|
||||
float angledelta(float a);
|
||||
float deltaPitch,deltaYaw;
|
||||
void CL_SendMove (usercmd_t *cmd)
|
||||
{
|
||||
int i;
|
||||
|
@ -342,6 +517,41 @@ void CL_SendMove (usercmd_t *cmd)
|
|||
|
||||
cl.cmd = *cmd;
|
||||
|
||||
//==== Aim Assist Code ====
|
||||
if((cl.stats[STAT_ZOOM]==1 || cl.stats[STAT_ZOOM]==2) && ((in_aimassist.value) || (cl.perks & 64)))
|
||||
{
|
||||
if(!zoom_snap)
|
||||
{
|
||||
|
||||
CL_Aim_Snap();
|
||||
zoom_snap = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
zoom_snap = 0;
|
||||
|
||||
//==== Sniper Scope Swaying ====
|
||||
if(cl.stats[STAT_ZOOM] == 2)
|
||||
{
|
||||
vec3_t vang;
|
||||
|
||||
VectorCopy(cl.viewangles,vang);
|
||||
|
||||
vang[0] -= deltaPitch;
|
||||
vang[1] -= deltaYaw;
|
||||
|
||||
deltaPitch =(cos(cl.time/0.7) + cos(cl.time) + sin(cl.time/1.1)) * 0.5;
|
||||
deltaYaw = (sin(cl.time/0.4) + cos(cl.time/0.56) + sin(cl.time)) * 0.5;
|
||||
|
||||
vang[0] += deltaPitch;
|
||||
vang[1] += deltaYaw;
|
||||
vang[0] = angledelta(vang[0]);
|
||||
vang[1] = angledelta(vang[1]);
|
||||
|
||||
VectorCopy(vang,cl.viewangles);
|
||||
//return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// send the movement message
|
||||
//
|
||||
|
@ -438,11 +648,19 @@ void CL_InitInput (void)
|
|||
Cmd_AddCommand ("-use", IN_UseUp);
|
||||
Cmd_AddCommand ("+jump", IN_JumpDown);
|
||||
Cmd_AddCommand ("-jump", IN_JumpUp);
|
||||
Cmd_AddCommand ("+grenade", IN_GrenadeDown);
|
||||
Cmd_AddCommand ("-grenade", IN_GrenadeUp);
|
||||
Cmd_AddCommand ("+switch", IN_SwitchDown);
|
||||
Cmd_AddCommand ("-switch", IN_SwitchUp);
|
||||
Cmd_AddCommand ("+reload", IN_ReloadDown);
|
||||
Cmd_AddCommand ("-reload", IN_ReloadUp);
|
||||
Cmd_AddCommand ("+knife", IN_KnifeDown);
|
||||
Cmd_AddCommand ("-knife", IN_KnifeUp);
|
||||
Cmd_AddCommand ("+aim", IN_AimDown);
|
||||
Cmd_AddCommand ("-aim", IN_AimUp);
|
||||
Cmd_AddCommand ("impulse", IN_Impulse);
|
||||
Cmd_AddCommand ("+klook", IN_KLookDown);
|
||||
Cmd_AddCommand ("-klook", IN_KLookUp);
|
||||
Cmd_AddCommand ("+mlook", IN_MLookDown);
|
||||
Cmd_AddCommand ("-mlook", IN_MLookUp);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// references them even when on a unix system.
|
||||
|
||||
// these two are not intended to be set directly
|
||||
cvar_t waypoint_mode = {"waypoint_mode", "0", false};// waypoint mode active
|
||||
cvar_t autosave_waypoint = {"autosave_waypoint", "0", false};// waypoint mode active
|
||||
cvar_t cl_name = {"_cl_name", "player", true};
|
||||
cvar_t cl_color = {"_cl_color", "0", true};
|
||||
|
||||
|
@ -730,9 +732,6 @@ void CL_Init (void)
|
|||
Cvar_RegisterVariable (&cl_name);
|
||||
Cvar_RegisterVariable (&cl_color);
|
||||
Cvar_RegisterVariable (&cl_upspeed);
|
||||
Cvar_RegisterVariable (&cl_forwardspeed);
|
||||
Cvar_RegisterVariable (&cl_backspeed);
|
||||
Cvar_RegisterVariable (&cl_sidespeed);
|
||||
Cvar_RegisterVariable (&cl_movespeedkey);
|
||||
Cvar_RegisterVariable (&cl_yawspeed);
|
||||
Cvar_RegisterVariable (&cl_pitchspeed);
|
||||
|
|
|
@ -598,6 +598,10 @@ void CL_ParseClientdata (int bits)
|
|||
cl.stats[STAT_CURRENTMAG] = i;
|
||||
}
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_ZOOM] != i)
|
||||
cl.stats[STAT_ZOOM] = i;
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
if (cl.stats[STAT_ROUNDS] != i)
|
||||
cl.stats[STAT_ROUNDS] = i;
|
||||
|
@ -818,7 +822,7 @@ void CL_ParseServerMessage (void)
|
|||
switch (cmd)
|
||||
{
|
||||
default:
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server message\n");
|
||||
Host_Error ("CL_ParseServerMessage: Illegible server message: cmd = %d\n", cmd);
|
||||
break;
|
||||
|
||||
case svc_nop:
|
||||
|
@ -965,14 +969,6 @@ void CL_ParseServerMessage (void)
|
|||
CL_SignonReply ();
|
||||
break;
|
||||
|
||||
case svc_killedmonster:
|
||||
cl.stats[STAT_MONSTERS]++;
|
||||
break;
|
||||
|
||||
case svc_foundsecret:
|
||||
cl.stats[STAT_SECRETS]++;
|
||||
break;
|
||||
|
||||
case svc_updatestat:
|
||||
i = MSG_ReadByte ();
|
||||
if (i < 0 || i >= MAX_CL_STATS)
|
||||
|
@ -1017,6 +1013,10 @@ void CL_ParseServerMessage (void)
|
|||
Cmd_ExecuteString ("help", src_command);
|
||||
break;
|
||||
|
||||
case svc_hitmark:
|
||||
Hitmark_Time = sv.time + 0.2;
|
||||
break;
|
||||
|
||||
case svc_weaponfire:
|
||||
CL_ParseWeaponFire();
|
||||
break;
|
||||
|
|
|
@ -247,9 +247,9 @@ extern cvar_t cl_name;
|
|||
extern cvar_t cl_color;
|
||||
|
||||
extern cvar_t cl_upspeed;
|
||||
extern cvar_t cl_forwardspeed;
|
||||
extern cvar_t cl_backspeed;
|
||||
extern cvar_t cl_sidespeed;
|
||||
extern float cl_forwardspeed;
|
||||
extern float cl_backspeed;
|
||||
extern float cl_sidespeed;
|
||||
|
||||
extern cvar_t cl_movespeedkey;
|
||||
|
||||
|
@ -321,7 +321,7 @@ typedef struct
|
|||
int state; // low bit is down state
|
||||
} kbutton_t;
|
||||
|
||||
extern kbutton_t in_mlook, in_klook;
|
||||
extern kbutton_t in_klook;
|
||||
extern kbutton_t in_strafe;
|
||||
extern kbutton_t in_speed;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ void Draw_Init (void);
|
|||
void Draw_Character (int x, int y, int num);
|
||||
void Draw_DebugChar (char num);
|
||||
void Draw_Pic (int x, int y, qpic_t *pic);
|
||||
void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a);
|
||||
void Draw_TransPic (int x, int y, qpic_t *pic);
|
||||
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation);
|
||||
void Draw_ConsoleBackground (int lines);
|
||||
|
|
174
source/gl_draw.c
174
source/gl_draw.c
|
@ -32,6 +32,8 @@ cvar_t gl_max_size = {"gl_max_size", "1024"};
|
|||
cvar_t gl_picmip = {"gl_picmip", "0"};
|
||||
|
||||
byte *draw_chars; // 8*8 graphic characters
|
||||
qpic_t *sniper_scope;
|
||||
|
||||
qpic_t *draw_disc;
|
||||
qpic_t *draw_backtile;
|
||||
|
||||
|
@ -61,8 +63,11 @@ typedef struct
|
|||
{
|
||||
int texnum;
|
||||
char identifier[64];
|
||||
int original_width;
|
||||
int original_height;
|
||||
int width, height;
|
||||
qboolean mipmap;
|
||||
qboolean islmp;
|
||||
int checksum;
|
||||
|
||||
// Diabolicka TGA
|
||||
|
@ -229,7 +234,7 @@ qpic_t *Draw_PicFromWad (char *name)
|
|||
return p;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
================
|
||||
Draw_CachePic
|
||||
|
@ -277,7 +282,71 @@ qpic_t *Draw_CachePic (char *path)
|
|||
|
||||
return &pic->pic;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_CachePic
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_CachePic (char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
qpic_t *dat;
|
||||
glpic_t *gl;
|
||||
char str[128];
|
||||
|
||||
strcpy (str, path);
|
||||
for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
|
||||
if (!strcmp (str, pic->name))
|
||||
return &pic->pic;
|
||||
|
||||
if (menu_numcachepics == MAX_CACHED_PICS)
|
||||
Sys_Error ("menu_numcachepics == MAX_CACHED_PICS");
|
||||
menu_numcachepics++;
|
||||
strcpy (pic->name, str);
|
||||
|
||||
//
|
||||
// load the pic from disk
|
||||
//
|
||||
|
||||
int index = loadtextureimage (str, 0, 0, qfalse, qfalse);
|
||||
if(index)
|
||||
{
|
||||
pic->pic.width = gltextures[index].original_width;
|
||||
pic->pic.height = gltextures[index].original_height;
|
||||
|
||||
gltextures[index].islmp = qfalse;
|
||||
gl = (glpic_t *)pic->pic.data;
|
||||
gl->texnum = index;
|
||||
|
||||
return &pic->pic;
|
||||
}
|
||||
|
||||
dat = (qpic_t *)COM_LoadTempFile (str);
|
||||
if (!dat)
|
||||
{
|
||||
strcat (str, ".lmp");
|
||||
dat = (qpic_t *)COM_LoadTempFile (str);
|
||||
if (!dat)
|
||||
{
|
||||
Con_Printf ("Draw_CachePic: failed to load file %s\n", str);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
SwapPic (dat);
|
||||
|
||||
|
||||
pic->pic.width = dat->width;
|
||||
pic->pic.height = dat->height;
|
||||
|
||||
gl = (glpic_t *)pic->pic.data;
|
||||
gl->texnum = GL_LoadPicTexture (dat);
|
||||
|
||||
gltextures[gl->texnum].islmp = qtrue;
|
||||
return &pic->pic;
|
||||
}
|
||||
|
||||
void Draw_CharToConback (int num, byte *dest)
|
||||
{
|
||||
|
@ -489,6 +558,7 @@ void Draw_Init (void)
|
|||
//
|
||||
draw_disc = Draw_PicFromWad ("disc");
|
||||
draw_backtile = Draw_PicFromWad ("backtile");
|
||||
sniper_scope = Draw_CachePic ("gfx/hud/scope");
|
||||
}
|
||||
|
||||
|
||||
|
@ -611,6 +681,16 @@ Draw_Pic
|
|||
=============
|
||||
*/
|
||||
void Draw_Pic (int x, int y, qpic_t *pic)
|
||||
{
|
||||
Draw_ColorPic (x, y, pic, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Draw_ColorPic
|
||||
=============
|
||||
*/
|
||||
void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g , float b, float a)
|
||||
{
|
||||
byte *dest, *source;
|
||||
unsigned short *pusdest;
|
||||
|
@ -620,7 +700,7 @@ void Draw_Pic (int x, int y, qpic_t *pic)
|
|||
if (scrap_dirty)
|
||||
Scrap_Upload ();
|
||||
gl = (glpic_t *)pic->data;
|
||||
glColor4f (1,1,1,1);
|
||||
glColor4f (r/255,g/255,b/255,a/255);
|
||||
GL_Bind (gl->texnum);
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (gl->sl, gl->tl);
|
||||
|
@ -634,7 +714,6 @@ void Draw_Pic (int x, int y, qpic_t *pic)
|
|||
glEnd ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
Draw_TransPic
|
||||
|
@ -1027,6 +1106,93 @@ int CrossHairMaxSpread (void)
|
|||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_Crosshair
|
||||
================
|
||||
*/
|
||||
|
||||
extern float crosshair_opacity;
|
||||
void Draw_Crosshair (void)
|
||||
{
|
||||
if (cl.stats[STAT_HEALTH] < 20)
|
||||
return;
|
||||
|
||||
if (!crosshair_opacity)
|
||||
crosshair_opacity = 255;
|
||||
|
||||
float col;
|
||||
|
||||
if (sv_player->v.facingenemy == 1) {
|
||||
col = 0;
|
||||
} else {
|
||||
col = 255;
|
||||
}
|
||||
|
||||
// crosshair moving
|
||||
if (crosshair_spread_time > sv.time && crosshair_spread_time)
|
||||
{
|
||||
cur_spread = cur_spread + 10;
|
||||
crosshair_opacity = 128;
|
||||
|
||||
if (cur_spread >= CrossHairMaxSpread())
|
||||
cur_spread = CrossHairMaxSpread();
|
||||
}
|
||||
// crosshair not moving
|
||||
else if (crosshair_spread_time < sv.time && crosshair_spread_time)
|
||||
{
|
||||
cur_spread = cur_spread - 4;
|
||||
crosshair_opacity = 255;
|
||||
|
||||
if (cur_spread <= 0) {
|
||||
cur_spread = 0;
|
||||
crosshair_spread_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (cl.stats[STAT_ACTIVEWEAPON] == W_M2 || cl.stats[STAT_ACTIVEWEAPON] == W_TESLA || cl.stats[STAT_ACTIVEWEAPON] == W_DG3)
|
||||
{
|
||||
Draw_CharacterRGBA((vid.width)/2-4, (vid.height)/2, 'O', 255, col, col, crosshair_opacity);
|
||||
}
|
||||
else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER)
|
||||
{
|
||||
int x_value, y_value;
|
||||
int crosshair_offset = CrossHairWeapon() + cur_spread;
|
||||
if (CrossHairMaxSpread() < crosshair_offset || croshhairmoving)
|
||||
crosshair_offset = CrossHairMaxSpread();
|
||||
|
||||
if (sv_player->v.view_ofs[2] == 8) {
|
||||
crosshair_offset *= 0.80;
|
||||
} else if (sv_player->v.view_ofs[2] == -10) {
|
||||
crosshair_offset *= 0.65;
|
||||
}
|
||||
|
||||
crosshair_offset_step += (crosshair_offset - crosshair_offset_step) * 0.5;
|
||||
|
||||
x_value = (vid.width - 8)/2 - crosshair_offset_step;
|
||||
y_value = (vid.height - 8)/2;
|
||||
Draw_CharacterRGBA(x_value, y_value, 158, 255, col, col, crosshair_opacity);
|
||||
|
||||
x_value = (vid.width - 8)/2 + crosshair_offset_step;
|
||||
y_value = (vid.height - 8)/2;
|
||||
Draw_CharacterRGBA(x_value, y_value, 158, 255, col, col, crosshair_opacity);
|
||||
|
||||
x_value = (vid.width - 8)/2;
|
||||
y_value = (vid.height - 8)/2 - crosshair_offset_step;
|
||||
Draw_CharacterRGBA(x_value, y_value, 157, 255, col, col, crosshair_opacity);
|
||||
|
||||
x_value = (vid.width - 8)/2;
|
||||
y_value = (vid.height - 8)/2 + crosshair_offset_step;
|
||||
Draw_CharacterRGBA(x_value, y_value, 157, 255, col, col, crosshair_opacity);
|
||||
}
|
||||
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2)
|
||||
Draw_CharacterRGBA((vid.width - 8)/2, (vid.height - 8)/2, '.', 255, col, col, crosshair_opacity);
|
||||
if (cl.stats[STAT_ZOOM] == 2)
|
||||
Draw_Pic (0, 0, sniper_scope);
|
||||
if (Hitmark_Time > sv.time)
|
||||
Draw_Pic ((vid.width - hitmark->width)/2,(vid.height - hitmark->height)/2, hitmark);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -2227,7 +2393,7 @@ int loadtextureimage (char* filename, int matchwidth, int matchheight, qboolean
|
|||
{
|
||||
int texnum;
|
||||
byte *data;
|
||||
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
|
||||
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
|
||||
return 0;
|
||||
texnum = GL_LoadTexture (filename, image_width, image_height, data, mipmap, qtrue, 4);
|
||||
free(data);
|
||||
|
|
|
@ -82,7 +82,7 @@ float scr_conlines; // lines of console to display
|
|||
float oldscreensize, oldfov;
|
||||
|
||||
cvar_t scr_viewsize = {"viewsize","100", true};
|
||||
cvar_t scr_fov = {"fov","90"}; // 10 - 170
|
||||
cvar_t scr_fov = {"fov","80", qtrue}; // 10 - 170
|
||||
cvar_t scr_conspeed = {"scr_conspeed","300"};
|
||||
cvar_t scr_centertime = {"scr_centertime","2"};
|
||||
cvar_t scr_showram = {"showram","1"};
|
||||
|
@ -463,6 +463,7 @@ void SCR_DrawUseString (void)
|
|||
l = strlen (scr_usestring);
|
||||
x = (vid.width - l*8)/2;
|
||||
|
||||
// naievil -- fixme
|
||||
Draw_String (x, y, scr_usestring);
|
||||
Draw_Pic (x + button_pic_x*8, y, GetButtonIcon("+use"));
|
||||
}
|
||||
|
@ -1125,6 +1126,47 @@ WARNING: be very careful calling this from elsewhere, because the refresh
|
|||
needs almost the entire 256k of stack space!
|
||||
==================
|
||||
*/
|
||||
|
||||
int GetWeaponZoomAmmount (void)
|
||||
{
|
||||
switch (cl.stats[STAT_ACTIVEWEAPON])
|
||||
{
|
||||
case W_MP40:
|
||||
case W_357:
|
||||
case W_SAWNOFF:
|
||||
case W_TRENCH:
|
||||
case W_PANZER:
|
||||
case W_RAY:
|
||||
case W_THOMPSON:
|
||||
case W_COLT:
|
||||
case W_PPSH:
|
||||
case W_TYPE:
|
||||
//case W_TESLA:
|
||||
return 5;
|
||||
break;
|
||||
case W_STG:
|
||||
case W_BROWNING:
|
||||
return 10;
|
||||
break;
|
||||
case W_KAR:
|
||||
case W_GEWEHR:
|
||||
case W_M1:
|
||||
case W_M1A1:
|
||||
case W_BAR:
|
||||
case W_FG:
|
||||
case W_KAR_SCOPE:
|
||||
case W_PTRS:
|
||||
//case W_HEADCRACKER:
|
||||
//case W_PENETRATOR:
|
||||
return 20;
|
||||
break;
|
||||
default:
|
||||
return 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float zoomin_time;
|
||||
int original_fov;
|
||||
void SCR_UpdateScreen (void)
|
||||
{
|
||||
static float oldscr_viewsize;
|
||||
|
@ -1154,20 +1196,84 @@ void SCR_UpdateScreen (void)
|
|||
|
||||
|
||||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
|
||||
//
|
||||
//
|
||||
// determine size of refresh window
|
||||
//
|
||||
if (cl.stats[STAT_ZOOM] == 1)
|
||||
{
|
||||
/*if (zoomin_time == 0 && !original_fov)
|
||||
{
|
||||
original_fov = scr_fov.value;
|
||||
zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value - 2.5);
|
||||
|
||||
}
|
||||
else if (zoomin_time < Sys_FloatTime ())
|
||||
{
|
||||
int tempfloat = original_fov - GetWeaponZoomAmmount();
|
||||
if (scr_fov.value > tempfloat)
|
||||
{
|
||||
zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value - 2.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_SetValue ("fov", tempfloat);
|
||||
zoomin_time = 0;
|
||||
}
|
||||
}*/
|
||||
if(!original_fov)
|
||||
original_fov = scr_fov.value;
|
||||
if(scr_fov.value > (GetWeaponZoomAmmount() + 1))//+1 for accounting for floating point inaccurraces
|
||||
{
|
||||
scr_fov.value += ((original_fov - GetWeaponZoomAmmount()) - scr_fov.value) * 0.25;
|
||||
Cvar_SetValue("fov",scr_fov.value);
|
||||
}
|
||||
}
|
||||
else if (cl.stats[STAT_ZOOM] == 2)
|
||||
{
|
||||
Cvar_SetValue ("fov", 30);
|
||||
zoomin_time = 0;
|
||||
}
|
||||
else if (cl.stats[STAT_ZOOM] == 3)
|
||||
{
|
||||
if(!original_fov)
|
||||
original_fov = scr_fov.value;
|
||||
//original_fov = scr_fov.value;
|
||||
scr_fov.value += (original_fov - 10 - scr_fov.value) * 0.3;
|
||||
Cvar_SetValue("fov",scr_fov.value);
|
||||
}
|
||||
else if (cl.stats[STAT_ZOOM] == 0 && original_fov != 0)
|
||||
{
|
||||
/*zoomin_time = Sys_FloatTime () + 0.01;
|
||||
Cvar_SetValue ("fov", scr_fov.value + 2.5);
|
||||
if (scr_fov.value == original_fov)
|
||||
{
|
||||
zoomin_time = 0;
|
||||
original_fov = 0;
|
||||
}*/
|
||||
if(scr_fov.value < (original_fov + 1))//+1 for accounting for floating point inaccuracies
|
||||
{
|
||||
scr_fov.value += (original_fov - scr_fov.value) * 0.25;
|
||||
Cvar_SetValue("fov",scr_fov.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
original_fov = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (oldfov != scr_fov.value)
|
||||
{
|
||||
oldfov = scr_fov.value;
|
||||
vid.recalc_refdef = true;
|
||||
vid.recalc_refdef = qtrue;
|
||||
}
|
||||
|
||||
if (oldscreensize != scr_viewsize.value)
|
||||
if (oldscreensize != 120)
|
||||
{
|
||||
oldscreensize = scr_viewsize.value;
|
||||
vid.recalc_refdef = true;
|
||||
oldscreensize = 120;
|
||||
vid.recalc_refdef = qtrue;
|
||||
}
|
||||
|
||||
if (vid.recalc_refdef)
|
||||
|
|
|
@ -923,6 +923,7 @@ void Host_Init (quakeparms_t *parms)
|
|||
#endif // _WIN32
|
||||
CDAudio_Init ();
|
||||
Sbar_Init ();
|
||||
HUD_Init ();
|
||||
CL_Init ();
|
||||
#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
|
||||
IN_Init ();
|
||||
|
|
294
source/in_null.c
294
source/in_null.c
|
@ -21,19 +21,313 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
extern int bind_grab;
|
||||
|
||||
extern cvar_t in_analog_strafe;
|
||||
extern cvar_t in_x_axis_adjust;
|
||||
extern cvar_t in_y_axis_adjust;
|
||||
extern cvar_t in_mlook; //Heffo - mlook cvar
|
||||
|
||||
void IN_Init (void)
|
||||
{
|
||||
// naievil -- fixme
|
||||
#if 0
|
||||
// Set up the controller.
|
||||
sceCtrlSetSamplingCycle(0);
|
||||
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||
|
||||
// Japanese users would prefer to have X as cancel and O as OK.
|
||||
//unsigned int okButton = PSP_CTRL_CIRCLE;
|
||||
//unsigned int cancelButton = PSP_CTRL_CROSS;
|
||||
unsigned int okButton = PSP_CTRL_CROSS;
|
||||
unsigned int cancelButton = PSP_CTRL_CIRCLE;
|
||||
|
||||
|
||||
// Build the button to Quake key maps.
|
||||
// Common keys:
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_SELECT)] = K_SELECT;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_START)] = K_ESCAPE;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_HOME)] = K_HOME;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_NOTE)] = K_NOTE;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_SCREEN)] = K_SCREEN;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_UP)] = K_UPARROW;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_RIGHT)] = K_RIGHTARROW;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_DOWN)] = K_DOWNARROW;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_LEFT)] = K_LEFTARROW;
|
||||
memcpy_vfpu(buttonToConsoleKeyMap, buttonToGameKeyMap, sizeof(ButtonToKeyMap));
|
||||
memcpy_vfpu(buttonToMessageKeyMap, buttonToGameKeyMap, sizeof(ButtonToKeyMap));
|
||||
memcpy_vfpu(buttonToMenuKeyMap, buttonToGameKeyMap, sizeof(ButtonToKeyMap));
|
||||
|
||||
// Game keys:
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_LTRIGGER)] = K_AUX1;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_RTRIGGER)] = K_AUX2;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_TRIANGLE)] = K_JOY1;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_CIRCLE)] = K_JOY2;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_CROSS)] = K_JOY3;
|
||||
buttonToGameKeyMap[buttonMaskToShift(PSP_CTRL_SQUARE)] = K_JOY4;
|
||||
|
||||
// Console keys:
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(PSP_CTRL_LTRIGGER)] = K_PGUP;
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(PSP_CTRL_RTRIGGER)] = K_PGDN;
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(okButton)] = K_ENTER;
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(cancelButton)] = K_ESCAPE;
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(PSP_CTRL_TRIANGLE)] = K_DEL;
|
||||
buttonToConsoleKeyMap[buttonMaskToShift(PSP_CTRL_SQUARE)] = K_INS;
|
||||
|
||||
// Message keys:
|
||||
memcpy_vfpu(buttonToMessageKeyMap, buttonToConsoleKeyMap, sizeof(ButtonToKeyMap));
|
||||
|
||||
// Menu keys:
|
||||
buttonToMenuKeyMap[buttonMaskToShift(PSP_CTRL_SQUARE)] = K_INS;
|
||||
buttonToMenuKeyMap[buttonMaskToShift(cancelButton)] = K_ESCAPE;
|
||||
buttonToMenuKeyMap[buttonMaskToShift(okButton)] = K_ENTER;
|
||||
buttonToMenuKeyMap[buttonMaskToShift(PSP_CTRL_TRIANGLE)] = K_DEL;
|
||||
buttonToMenuKeyMap[buttonMaskToShift(PSP_CTRL_LTRIGGER)] = K_AUX1;
|
||||
buttonToMenuKeyMap[buttonMaskToShift(PSP_CTRL_RTRIGGER)] = K_AUX2;
|
||||
#endif
|
||||
}
|
||||
|
||||
void IN_Shutdown (void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void IN_Commands (void)
|
||||
{
|
||||
// naievil -- fixme
|
||||
#if 0
|
||||
// Changed in or out of key binding mode?
|
||||
if ((bind_grab != 0) != readyToBindKeys)
|
||||
{
|
||||
// Was in key binding mode?
|
||||
if (readyToBindKeys)
|
||||
{
|
||||
// Just left key binding mode.
|
||||
// Release all keys which are pressed.
|
||||
for (unsigned int button = 0; button < buttonCount; ++button)
|
||||
{
|
||||
// Was the button pressed?
|
||||
if (lastPad.Buttons & (1 << button))
|
||||
{
|
||||
// Is the button in the map?
|
||||
const int key = buttonToGameKeyMap[button];
|
||||
if (key)
|
||||
{
|
||||
// Send a release event.
|
||||
Key_Event(key, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We're not ready to bind keys any more.
|
||||
readyToBindKeys = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Entering key binding mode.
|
||||
// Release all keys which are pressed.
|
||||
for (unsigned int button = 0; button < buttonCount; ++button)
|
||||
{
|
||||
// Was the button pressed?
|
||||
if (lastPad.Buttons & (1 << button))
|
||||
{
|
||||
// Is the button in the map?
|
||||
const int key = buttonToMenuKeyMap[button];
|
||||
if (key)
|
||||
{
|
||||
// Send a release event.
|
||||
Key_Event(key, qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We're now ready to bind keys.
|
||||
readyToBindKeys = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Use a different key mapping depending on where inputs are going to go.
|
||||
const ButtonToKeyMap* buttonToKeyMap = 0;
|
||||
switch (key_dest)
|
||||
{
|
||||
case key_game:
|
||||
buttonToKeyMap = &buttonToGameKeyMap;
|
||||
break;
|
||||
|
||||
case key_console:
|
||||
buttonToKeyMap = &buttonToConsoleKeyMap;
|
||||
break;
|
||||
|
||||
case key_message:
|
||||
buttonToKeyMap = &buttonToMessageKeyMap;
|
||||
break;
|
||||
|
||||
case key_menu:
|
||||
case key_menu_pause:
|
||||
// Binding keys?
|
||||
if (readyToBindKeys)
|
||||
{
|
||||
buttonToKeyMap = &buttonToGameKeyMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonToKeyMap = &buttonToMenuKeyMap;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Sys_Error("Unhandled key destination %d", key_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
// Read the pad state.
|
||||
SceCtrlData pad;
|
||||
sceCtrlPeekBufferPositive(&pad, 1);
|
||||
|
||||
// Find out which buttons have changed.
|
||||
SceCtrlData deltaPad;
|
||||
deltaPad.Buttons = pad.Buttons ^ lastPad.Buttons;
|
||||
deltaPad.Lx = pad.Lx - lastPad.Lx;
|
||||
deltaPad.Ly = pad.Ly - lastPad.Ly;
|
||||
deltaPad.TimeStamp = pad.TimeStamp - lastPad.TimeStamp;
|
||||
|
||||
// Handle buttons which have changed.
|
||||
for (unsigned int button = 0; button < buttonCount; ++button)
|
||||
{
|
||||
// Has the button changed?
|
||||
const unsigned int buttonMask = 1 << button;
|
||||
|
||||
if (deltaPad.Buttons & buttonMask)
|
||||
{
|
||||
// Is the button in the map?
|
||||
const int key = (*buttonToKeyMap)[button];
|
||||
if (key)
|
||||
{
|
||||
// Send an event.
|
||||
const qboolean state = (pad.Buttons & buttonMask) ? qtrue : qfalse;
|
||||
Key_Event(key, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remember the pad state for next time.
|
||||
lastPad = pad;
|
||||
#endif
|
||||
}
|
||||
|
||||
float IN_CalcInput(int axis, float speed, float tolerance, float acceleration) {
|
||||
|
||||
// naievil -- fixme
|
||||
#if 0
|
||||
float value = ((float) axis / 128.0f) - 1.0f;
|
||||
|
||||
if (value == 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float abs_value = fabs(value);
|
||||
|
||||
if (abs_value < tolerance) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
abs_value -= tolerance;
|
||||
abs_value /= (1.0f - tolerance);
|
||||
abs_value = powf(abs_value, acceleration);
|
||||
abs_value *= speed;
|
||||
|
||||
if (value < 0.0f) {
|
||||
value = -abs_value;
|
||||
} else {
|
||||
value = abs_value;
|
||||
}
|
||||
return value;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern cvar_t scr_fov;
|
||||
extern int original_fov, final_fov;
|
||||
void IN_Move (usercmd_t *cmd)
|
||||
{
|
||||
// naievil -- fixme
|
||||
#if 0
|
||||
unsigned char analog_strafe = 0;
|
||||
// Don't let the pitch drift back to centre if analog nub look is on.
|
||||
if (in_mlook.value)
|
||||
V_StopPitchDrift();
|
||||
else {
|
||||
if (in_analog_strafe.value || (in_strafe.state & 1)) {
|
||||
analog_strafe = 1;
|
||||
}
|
||||
}
|
||||
// Read the pad state.
|
||||
SceCtrlData pad;
|
||||
sceCtrlPeekBufferPositive(&pad, 1);
|
||||
|
||||
// Convert the inputs to floats in the range [-1, 1].
|
||||
// Implement the dead zone.
|
||||
float speed;
|
||||
float deadZone = in_tolerance.value;
|
||||
float acceleration = in_acceleration.value;
|
||||
int x_adjust = in_x_axis_adjust.value;
|
||||
int y_adjust = in_y_axis_adjust.value;
|
||||
|
||||
//shpuld begin
|
||||
if (!analog_strafe) {
|
||||
speed = in_sensitivity.value;
|
||||
|
||||
// ==== Aim Assist + ====
|
||||
// cut look speed in half when facing enemy, unless
|
||||
// mag is empty
|
||||
if ((in_aimassist.value) && (sv_player->v.facingenemy == 1) && cl.stats[STAT_CURRENTMAG] > 0) {
|
||||
speed *= 0.5;
|
||||
}
|
||||
// additionally, slice look speed when ADS/scopes
|
||||
if (cl.stats[STAT_ZOOM] == 1)
|
||||
speed *= 0.5;
|
||||
else if (cl.stats[STAT_ZOOM] == 2)
|
||||
speed *= 0.25;
|
||||
} else {
|
||||
speed = sv_player->v.maxspeed/150;
|
||||
if (cl.stats[STAT_ZOOM] == 1)
|
||||
speed *= 2;
|
||||
else if (cl.stats[STAT_ZOOM] == 2)
|
||||
speed *= 4;
|
||||
}
|
||||
//shpuld end
|
||||
|
||||
float x = IN_CalcInput(pad.Lx+x_adjust, speed, deadZone, acceleration);
|
||||
float y = IN_CalcInput(pad.Ly+y_adjust, speed, deadZone, acceleration);
|
||||
|
||||
// Set the yaw.
|
||||
|
||||
// Analog nub look?
|
||||
if (!analog_strafe) {
|
||||
const float yawScale = 30.0f;
|
||||
cl.viewangles[YAW] -= yawScale * x * host_frametime;
|
||||
|
||||
if (in_mlook.value)
|
||||
{
|
||||
// Set the pitch.
|
||||
const bool invertPitch = m_pitch.value < 0;
|
||||
const float pitchScale = yawScale * (invertPitch ? -1 : 1);
|
||||
cl.viewangles[PITCH] += pitchScale * y * host_frametime;
|
||||
|
||||
// Don't look too far up or down.
|
||||
if (cl.viewangles[PITCH] > 80.0f)
|
||||
cl.viewangles[PITCH] = 80.0f;
|
||||
if (cl.viewangles[PITCH] < -70.0f)
|
||||
cl.viewangles[PITCH] = -70.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Move using up and down.
|
||||
cmd->forwardmove -= cl_forwardspeed * y;
|
||||
}
|
||||
} else {
|
||||
cmd->sidemove += cl_sidespeed * x;
|
||||
cmd->forwardmove -= cl_forwardspeed * y;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
|
||||
typedef enum {key_game, key_console, key_message, key_menu} keydest_t;
|
||||
typedef enum {key_game, key_console, key_message, key_menu, key_menu_pause} keydest_t;
|
||||
|
||||
extern keydest_t key_dest;
|
||||
extern char *keybindings[256];
|
||||
|
@ -129,5 +129,4 @@ void Key_Event (int key, qboolean down);
|
|||
void Key_Init (void);
|
||||
void Key_WriteBindings (FILE *f);
|
||||
void Key_SetBinding (int keynum, char *binding);
|
||||
void Key_ClearStates (void);
|
||||
|
||||
void Key_ClearStates (void);
|
|
@ -288,6 +288,40 @@ if (sides == 0)
|
|||
|
||||
#endif
|
||||
|
||||
void vectoangles (vec3_t vec, vec3_t ang)
|
||||
{
|
||||
float forward, yaw, pitch;
|
||||
|
||||
if (!vec[1] && !vec[0])
|
||||
{
|
||||
yaw = 0;
|
||||
pitch = (vec[2] > 0) ? 90 : 270;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef PSP_VFPU
|
||||
yaw = vec[0] ? (vfpu_atan2f(vec[1], vec[0]) * 180 / M_PI) : (vec[1] > 0) ? 90 : 270;
|
||||
#else
|
||||
yaw = vec[0] ? (atan2(vec[1], vec[0]) * 180 / M_PI) : (vec[1] > 0) ? 90 : 270;
|
||||
#endif
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
|
||||
#ifdef PSP_VFPU
|
||||
forward = vfpu_sqrtf (vec[0] * vec[0] + vec[1] * vec[1]);
|
||||
pitch = vfpu_atan2f (vec[2], forward) * 180 / M_PI;
|
||||
#else
|
||||
forward = sqrt (vec[0] * vec[0] + vec[1] * vec[1]);
|
||||
pitch = atan2 (vec[2], forward) * 180 / M_PI;
|
||||
#endif
|
||||
if (pitch < 0)
|
||||
pitch += 360;
|
||||
}
|
||||
|
||||
ang[0] = pitch;
|
||||
ang[1] = yaw;
|
||||
ang[2] = 0;
|
||||
}
|
||||
|
||||
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@ void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
|
|||
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
|
||||
void _VectorCopy (vec3_t in, vec3_t out);
|
||||
|
||||
void vectoangles (vec3_t vec, vec3_t ang);
|
||||
|
||||
int VectorCompare (vec3_t v1, vec3_t v2);
|
||||
vec_t Length (vec3_t v);
|
||||
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
|
||||
|
|
|
@ -1113,14 +1113,14 @@ void M_AdjustSliders (int dir)
|
|||
break;
|
||||
|
||||
case 8: // allways run
|
||||
if (cl_forwardspeed.value > 200)
|
||||
if (cl_forwardspeed > 200)
|
||||
{
|
||||
Cvar_SetValue ("cl_forwardspeed", 200);
|
||||
cl_forwardspeed = 200;
|
||||
Cvar_SetValue ("cl_backspeed", 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_SetValue ("cl_forwardspeed", 400);
|
||||
cl_forwardspeed = 400;
|
||||
Cvar_SetValue ("cl_backspeed", 400);
|
||||
}
|
||||
break;
|
||||
|
@ -1209,7 +1209,7 @@ void M_Options_Draw (void)
|
|||
M_DrawSlider (220, 88, r);
|
||||
|
||||
M_Print (16, 96, " Always Run");
|
||||
M_DrawCheckbox (220, 96, cl_forwardspeed.value > 200);
|
||||
M_DrawCheckbox (220, 96, cl_forwardspeed > 200);
|
||||
|
||||
M_Print (16, 104, " Invert Mouse");
|
||||
M_DrawCheckbox (220, 104, m_pitch.value < 0);
|
||||
|
|
|
@ -116,6 +116,7 @@ typedef struct
|
|||
float weaponframe;
|
||||
float currentammo;
|
||||
float currentmag;
|
||||
float zoom;
|
||||
float items;
|
||||
float takedamage;
|
||||
int chain;
|
||||
|
@ -160,6 +161,8 @@ typedef struct
|
|||
vec3_t ADS_Offset;
|
||||
string_t Weapon_Name;
|
||||
string_t Weapon_Name_Touch;
|
||||
float maxspeed;
|
||||
float facingenemy;
|
||||
} entvars_t;
|
||||
|
||||
#define PROGHEADER_CRC 5927
|
||||
|
|
|
@ -117,9 +117,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define svc_centerprint 26 // [string] to put in center of the screen
|
||||
|
||||
#define svc_killedmonster 27
|
||||
#define svc_foundsecret 28
|
||||
|
||||
#define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten
|
||||
|
||||
#define svc_intermission 30 // [string] music
|
||||
|
|
|
@ -125,27 +125,18 @@ void VID_UnlockBuffer (void);
|
|||
#define STAT_points 1
|
||||
#define STAT_WEAPON 2
|
||||
#define STAT_AMMO 3
|
||||
#define STAT_SECGRENADES 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_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_GRENADES 9
|
||||
#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
|
||||
|
|
|
@ -56,3 +56,5 @@ extern int scr_copyeverything;
|
|||
extern qboolean block_drawing;
|
||||
|
||||
void SCR_UpdateWholeScreen (void);
|
||||
|
||||
extern cvar_t scr_fov;
|
|
@ -36,8 +36,9 @@ qboolean SNDDMA_Init(void)
|
|||
{
|
||||
sound_initialized = 0;
|
||||
|
||||
if(ndspInit() != 0)
|
||||
if(ndspInit() != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
audio_buffer = linearAlloc(BUFFER_SIZE);
|
||||
|
||||
|
|
|
@ -689,6 +689,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
MSG_WriteShort (msg, ent->v.health);
|
||||
MSG_WriteByte (msg, ent->v.currentammo);
|
||||
MSG_WriteByte (msg, ent->v.currentmag);
|
||||
MSG_WriteByte (msg, ent->v.zoom);
|
||||
|
||||
MSG_WriteByte (msg, pr_global_struct->rounds);
|
||||
MSG_WriteByte (msg, pr_global_struct->rounds_change);
|
||||
|
|
|
@ -275,7 +275,7 @@ void V_DriftPitch (void)
|
|||
// don't count small mouse motion
|
||||
if (cl.nodrift)
|
||||
{
|
||||
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed.value)
|
||||
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed)
|
||||
cl.driftmove = 0;
|
||||
else
|
||||
cl.driftmove += host_frametime;
|
||||
|
|
Loading…
Reference in a new issue