More 3DS + PSP unification

This commit is contained in:
cypress 2024-09-06 18:07:31 -07:00
parent 59cc8a5471
commit b5d29cb1c2
21 changed files with 1095 additions and 515 deletions

View file

@ -120,7 +120,8 @@ COMMON_OBJS = chase.c \
gl_warp.c \
gl_vidctr.c \
r_part.c \
touch_ctr.c
touch_ctr.c \
crypter.c
CFILES := $(COMMON_OBJS)
CPPFILES :=

View file

@ -20,8 +20,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int CDAudio_Init(void);
void CDAudio_Play(byte track, qboolean looping);
#ifdef __PSP__
void CDAudio_PlayFromString(char* track_name, qboolean looping);
#endif // __PSP__
void CDAudio_Stop(void);
void CDAudio_Pause(void);
void CDAudio_Resume(void);
void CDAudio_Shutdown(void);
void CDAudio_Update(void);
#ifdef __PSP__
void CDAudio_Next(void);
void CDAudio_Prev(void);
void CDAudio_PrintMusicList(void);
void CDAudio_Track(char* trackname);
#endif // __PSP__

View file

@ -703,7 +703,7 @@ void HUD_Rounds (void)
HUD_WorldText(value2);
if (has_chaptertitle == false)
Draw_ColoredString(6, vid.height/2 + 50, "'Nazi Zombies'", 255, 255, 255, value2, 1);
Draw_ColoredString(6, vid.height/2 + 10, "'Nazi Zombies'", 255, 255, 255, value2, 1);
value -= cl.time * 0.4;
value2 += cl.time * 0.4;
@ -719,7 +719,7 @@ void HUD_Rounds (void)
HUD_WorldText(255);
if (has_chaptertitle == false)
Draw_ColoredString(4, vid.height/2 + 50, "'Nazi Zombies'", 255, 255, 255, 255, 1);
Draw_ColoredString(4, vid.height/2 + 10, "'Nazi Zombies'", 255, 255, 255, 255, 1);
value2 += cl.time * 0.4;
@ -733,7 +733,7 @@ void HUD_Rounds (void)
HUD_WorldText(value2);
if (has_chaptertitle == false)
Draw_ColoredString(4, vid.height/2 + 50, "'Nazi Zombies'", 255, 255, 255, value2, 1);
Draw_ColoredString(4, vid.height/2 + 10, "'Nazi Zombies'", 255, 255, 255, value2, 1);
value2 -= cl.time * 0.4;

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -55,6 +55,7 @@ kbutton_t in_up, in_down;
int in_impulse;
void KeyDown (kbutton_t *b)
{
int k;
@ -68,7 +69,7 @@ void KeyDown (kbutton_t *b)
if (k == b->down[0] || k == b->down[1])
return; // repeating key
if (!b->down[0])
b->down[0] = k;
else if (!b->down[1])
@ -78,7 +79,7 @@ void KeyDown (kbutton_t *b)
Con_Printf ("Three keys down for a button!\n");
return;
}
if (b->state & 1)
return; // still down
b->state |= 1 + 2; // down + impulse down
@ -88,7 +89,7 @@ void KeyUp (kbutton_t *b)
{
int k;
char *c;
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
@ -118,14 +119,14 @@ 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) {
/*void IN_MLookDown (void) {KeyDown(&in_mlook);}
void IN_MLookUp (void){
KeyUp(&in_mlook);
if ( !(in_mlook.state&1) && lookspring.value)
V_StartPitchDrift();
}
*/
} Heffo - mlook cvar*/
void IN_UpDown(void) {KeyDown(&in_up);}
void IN_UpUp(void) {KeyUp(&in_up);}
void IN_DownDown(void) {KeyDown(&in_down);}
@ -135,7 +136,11 @@ void IN_LeftUp(void) {KeyUp(&in_left);}
void IN_RightDown(void) {KeyDown(&in_right);}
void IN_RightUp(void) {KeyUp(&in_right);}
void IN_ForwardDown(void) {KeyDown(&in_forward);}
void IN_ForwardUp(void) {KeyUp(&in_forward);}
void IN_ForwardUp(void) {KeyUp(&in_forward);
#ifdef __PSP__
Cbuf_AddText("impulse 24\n");
#endif // __PSP__
}
void IN_BackDown(void) {KeyDown(&in_back);}
void IN_BackUp(void) {KeyUp(&in_back);}
void IN_LookupDown(void) {KeyDown(&in_lookup);}
@ -186,13 +191,13 @@ float CL_KeyState (kbutton_t *key)
{
float val;
qboolean impulsedown, impulseup, down;
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
if (impulsedown && !impulseup)
if (impulsedown && !impulseup)
{
if (down)
val = 0.5; // pressed and held this frame
@ -222,7 +227,7 @@ float CL_KeyState (kbutton_t *key)
}
key->state &= 1; // clear impulses
return val;
}
@ -246,6 +251,7 @@ 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;
@ -256,6 +262,8 @@ CL_AdjustAngles
Moves the local angle positions
================
*/
extern int original_fov, final_fov;
void CL_AdjustAngles (void)
{
@ -272,11 +280,28 @@ void CL_AdjustAngles (void)
//speed = speed*final_fov/original_fov;
//shpuld end
// ==== 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;
if (!(in_strafe.state & 1))
{
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left);
#ifdef __PSP__
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right) * in_sensitivity.value;
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left) * in_sensitivity.value;
#else
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right) * sensitivity.value;
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left) * sensitivity.value;
#endif // __PSP__
cl.viewangles[YAW] = anglemod(cl.viewangles[YAW]);
}
if (in_klook.state & 1)
@ -286,8 +311,13 @@ void CL_AdjustAngles (void)
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
}
up = CL_KeyState (&in_lookup);
down = CL_KeyState(&in_lookdown);
#ifdef __PSP__
up = CL_KeyState (&in_lookup) * in_sensitivity.value;
down = CL_KeyState(&in_lookdown) * in_sensitivity.value;
#else
up = CL_KeyState (&in_lookup) * sensitivity.value;
down = CL_KeyState(&in_lookdown) * sensitivity.value;
#endif // __PSP__
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
@ -314,18 +344,22 @@ CL_BaseMove
Send the intended movement message to the server
================
*/
extern cvar_t waypoint_mode;
qboolean in_game;
float crosshair_opacity;
void CL_BaseMove (usercmd_t *cmd)
{
{
if (cls.signon != SIGNONS)//BLUBS CHANGED HERE
return;
in_game = true;
CL_AdjustAngles ();
Q_memset (cmd, 0, sizeof(*cmd));
// Moto - we handle movespeed in QC now.
// cypress - we handle movespeed in QC now.
cl_backspeed = cl_forwardspeed = cl_sidespeed = sv_player->v.maxspeed;
// Throttle side and back speeds
@ -471,9 +505,9 @@ void CL_Aim_Snap(void)
}
}
if (cl.perks & 64)
znum = EN_Find(znum,"ai_zombie_head");
else
znum = EN_Find(znum,"ai_zombie");
znum = EN_Find(znum,"ai_zombie_head");
else
znum = EN_Find(znum,"ai_zombie");
z = EDICT_NUM(znum);
}
@ -507,14 +541,14 @@ float deltaPitch,deltaYaw;
void CL_SendMove (usercmd_t *cmd)
{
int i;
int bits;
long int bits;
sizebuf_t buf;
byte data[128];
vec3_t tempv;
buf.maxsize = 128;
buf.cursize = 0;
buf.data = data;
cl.cmd = *cmd;
//==== Aim Assist Code ====
@ -522,13 +556,13 @@ void CL_SendMove (usercmd_t *cmd)
{
if(!zoom_snap)
{
CL_Aim_Snap();
zoom_snap = 1;
}
}
else {
else
zoom_snap = 0;
}
//==== Sniper Scope Swaying ====
if(cl.stats[STAT_ZOOM] == 2 && !(cl.perks & 64))
@ -540,8 +574,13 @@ void CL_SendMove (usercmd_t *cmd)
vang[0] -= deltaPitch;
vang[1] -= deltaYaw;
#ifdef PSP_VFPU
deltaPitch =(vfpu_cosf(cl.time/0.7) + vfpu_cosf(cl.time) + vfpu_sinf(cl.time/1.1)) * 0.5;
deltaYaw = (vfpu_sinf(cl.time/0.4) + vfpu_cosf(cl.time/0.56) + vfpu_sinf(cl.time)) * 0.5;
#else
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;
#endif
vang[0] += deltaPitch;
vang[1] += deltaYaw;
@ -680,5 +719,7 @@ void CL_InitInput (void)
Cmd_AddCommand ("+klook", IN_KLookDown);
Cmd_AddCommand ("-klook", IN_KLookUp);
}

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl_main.c -- client main loop
#include "quakedef.h"
#include "cl_slist.h"
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
@ -28,41 +29,60 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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};
cvar_t cl_truelightning = {"cl_truelightning", "1", true};
cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2
cvar_t cl_nolerp = {"cl_nolerp","0"};
cvar_t cl_lightning_zadjust = {"cl_lightning_zadjust", "0", true};
cvar_t lookspring = {"lookspring","0", true};
cvar_t lookstrafe = {"lookstrafe","0", true};
#ifdef __PSP__
cvar_t in_sensitivity = {"sensitivity","3", true};
#else
cvar_t sensitivity = {"sensitivity","8", true};
#endif // __PSP__
cvar_t in_tolerance = {"tolerance","0.25", true};
cvar_t in_acceleration = {"acceleration","1.0", true};
cvar_t cl_rocket2grenade = {"cl_r2g", "0"};
cvar_t cl_deadbodyfilter = {"cl_deadbodyfilter", "0"};
cvar_t cl_gibfilter = {"cl_gibfilter", "0"};
cvar_t m_pitch = {"m_pitch","0.022", true};
cvar_t m_yaw = {"m_yaw","0.022", true};
cvar_t m_forward = {"m_forward","1", true};
cvar_t m_side = {"m_side","0.8", true};
cvar_t in_disable_analog = {"in_disable_analog", "0", true};
cvar_t in_analog_strafe = {"in_analog_strafe", "0", true};
cvar_t in_x_axis_adjust = {"in_x_axis_adjust", "0", true};
cvar_t in_y_axis_adjust = {"in_y_axis_adjust", "0", true};
cvar_t m_pitch = {"m_pitch","-0.22", true};
cvar_t m_yaw = {"m_yaw","0", true};
cvar_t m_forward = {"m_forward","0", true};
cvar_t m_side = {"m_side","0", true};
//=================================================//
modelindex_t cl_modelindex[NUM_MODELINDEX]; //
char *cl_modelnames[NUM_MODELINDEX];//
//
#ifdef __PSP__
tagentity_t q3player_body, q3player_head; //
#endif // __PSP__
//=================================================//
client_static_t cls;
client_state_t cl;
// FIXME: put these on hunk?
modelindex_t cl_modelindex[NUM_MODELINDEX];
char *cl_modelnames[NUM_MODELINDEX];
efrag_t cl_efrags[MAX_EFRAGS];
entity_t cl_entities[MAX_EDICTS];
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
lightstyle_t cl_lightstyle[MAX_LIGHTSTYLES];
dlight_t cl_dlights[MAX_DLIGHTS];
modelindex_t cl_modelindex[NUM_MODELINDEX];
int cl_numvisedicts;
entity_t *cl_visedicts[MAX_VISEDICTS];
int cl_numstaticbrushmodels;
entity_t *cl_staticbrushmodels[MAX_VISEDICTS];
int cl_numstaticbrushmodels;
entity_t *cl_staticbrushmodels[MAX_VISEDICTS];
void CL_ClearTEnts (void);
/*
=====================
@ -77,12 +97,13 @@ void CL_ClearState (void)
if (!sv.active)
Host_ClearMemory ();
CL_ClearTEnts ();
// wipe the entire cl structure
memset (&cl, 0, sizeof(cl));
SZ_Clear (&cls.message);
// clear other arrays
// clear other arrays
memset (cl_efrags, 0, sizeof(cl_efrags));
memset (cl_entities, 0, sizeof(cl_entities));
memset (cl_dlights, 0, sizeof(cl_dlights));
@ -90,6 +111,7 @@ void CL_ClearState (void)
memset (cl_temp_entities, 0, sizeof(cl_temp_entities));
memset (cl_beams, 0, sizeof(cl_beams));
memset (cl_static_entities, 0, sizeof(cl_static_entities));
//
// allocate the efrags and chain together into a free list
//
@ -111,7 +133,7 @@ void CL_Disconnect (void)
{
// stop sounds (especially looping!)
S_StopAllSounds (true);
// bring the console down and fade the colors back to normal
// SCR_BringDownConsole ();
@ -169,8 +191,9 @@ void CL_EstablishConnection (char *host)
cls.netcon = NET_Connect (host);
if (!cls.netcon)
Host_Error ("CL_Connect: connect failed\n");
Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host);
//Con_DPrintf ("CL_EstablishConnection: connected to %s\n", host);
Con_Printf ("CL_EstablishConnection: connected to %s\n", host);
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
cls.signon = 0; // need all the signon messages before playing
@ -187,36 +210,37 @@ void CL_SignonReply (void)
{
char str[8192];
Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
//Con_Printf ("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon)
{
case 1:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "prespawn");
break;
case 2:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
MSG_WriteByte (&cls.message, clc_stringcmd);
sprintf (str, "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str);
break;
case 3:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "begin");
Cache_Report (); // print remaining memory
break;
case 4:
SCR_EndLoadingPlaque (); // allow normal screen updates
break;
case 1:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "prespawn");
break;
case 2:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
MSG_WriteByte (&cls.message, clc_stringcmd);
sprintf (str, "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str);
break;
case 3: //just sets client.spawned = true
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "begin");
Cache_Report (); // print remaining memory
break;
case 4:
{
SCR_EndLoadingPlaque (); // allow normal screen updates
break;
}
}
}
@ -261,7 +285,7 @@ void CL_PrintEntities_f (void)
{
entity_t *ent;
int i;
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
{
Con_Printf ("%3i:",i);
@ -289,7 +313,7 @@ void SetPal (int i)
static int old;
byte pal[768];
int c;
if (i == old)
return;
old = i;
@ -319,6 +343,43 @@ void SetPal (int i)
#endif
}
#ifdef __PSP__
void CL_CopyPlayerInfo (entity_t *ent, entity_t *player)
{
memcpy_vfpu(&ent->baseline, &player->baseline, sizeof(entity_state_t));
ent->msgtime = player->msgtime;
memcpy_vfpu(ent->msg_origins, player->msg_origins, sizeof(ent->msg_origins));
VectorCopy (player->origin, ent->origin);
memcpy_vfpu(ent->msg_angles, player->msg_angles, sizeof(ent->msg_angles));
VectorCopy (player->angles, ent->angles);
ent->model = (ent == &q3player_body.ent) ? cl.model_precache[cl_modelindex[mi_q3torso]] : cl.model_precache[cl_modelindex[mi_q3head]];
ent->efrag = player->efrag;
ent->frame = player->frame;
ent->syncbase = player->syncbase;
ent->colormap = player->colormap;
ent->effects = player->effects;
ent->skinnum = player->skinnum;
ent->visframe = player->visframe;
ent->dlightframe = player->dlightframe;
ent->dlightbits = player->dlightbits;
ent->trivial_accept = player->trivial_accept;
ent->topnode = player->topnode;
ent->modelindex = (ent == &q3player_body.ent) ? cl_modelindex[mi_q3torso] : cl_modelindex[mi_q3head];
ent->noshadow = player->noshadow;
ent->rendermode = player->rendermode;
ent->renderamt = player->renderamt;
//ent->rendercolor = player->rendercolor;
}
#endif // __PSP__
/*
===============
CL_AllocDlight
@ -340,7 +401,7 @@ dlight_t *CL_AllocDlight (int key)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
dl->color[0] = dl->color[1] = dl->color[2] = 1; // LordHavoc: .lit support
return dl;
}
}
@ -354,7 +415,7 @@ dlight_t *CL_AllocDlight (int key)
{
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
dl->color[0] = dl->color[1] = dl->color[2] = 1; // LordHavoc: .lit support
return dl;
}
}
@ -362,7 +423,7 @@ dlight_t *CL_AllocDlight (int key)
dl = &cl_dlights[0];
memset (dl, 0, sizeof(*dl));
dl->key = key;
dl->color[0] = dl->color[1] = dl->color[2] = 1; //johnfitz -- lit support via lordhavoc
dl->color[0] = dl->color[1] = dl->color[2] = 1; // LordHavoc: .lit support
return dl;
}
@ -407,7 +468,7 @@ void CL_DecayLights (void)
int i;
dlight_t *dl;
float time;
time = cl.time - cl.oldtime;
dl = cl_dlights;
@ -415,7 +476,7 @@ void CL_DecayLights (void)
{
if (dl->die < cl.time || !dl->radius)
continue;
dl->radius -= time*dl->decay;
if (dl->radius < 0)
dl->radius = 0;
@ -431,32 +492,30 @@ Determines the fraction between the last two messages that the objects
should be put at.
===============
*/
float CL_LerpPoint (void)
float CL_LerpPoint (void)
{
float f, frac;
f = cl.mtime[0] - cl.mtime[1];
if (!f || cl_nolerp.value || cls.timedemo || sv.active)
{
cl.ctime = cl.time = cl.mtime[0];
return 1;
}
if (f > 0.1)
{ // dropped packet, or start of demo
cl.mtime[1] = cl.mtime[0] - 0.1;
f = 0.1;
}
frac = (cl.ctime - cl.mtime[1]) / f;
//Con_Printf ("frac: %f\n",frac);
if (frac < 0)
{
if (frac < -0.01)
{
SetPal(1);
cl.ctime = cl.time = cl.mtime[1];
// Con_Printf ("low frac\n");
}
frac = 0;
}
@ -464,18 +523,17 @@ SetPal(1);
{
if (frac > 1.01)
{
SetPal(2);
cl.ctime = cl.time = cl.mtime[0];
// Con_Printf ("high frac\n");
}
frac = 1;
}
else
SetPal(0);
return frac;
}
extern cvar_t scr_fov;
float mdlflag_poweruprotate_duration = 0.0f;
float mdlflag_poweruprotate_starttime = 0.0f;
@ -536,6 +594,7 @@ void CL_UpdatePowerUpAngles (void)
CL_RelinkEntities
===============
*/
void CL_RelinkEntities (void)
{
entity_t *ent;
@ -543,26 +602,26 @@ void CL_RelinkEntities (void)
float frac, f, d;
vec3_t delta;
vec3_t oldorg;
//model_t *model;
dlight_t *dl;
// determine partial update time
//vec3_t smokeorg, smokeorg2;
//float scale;
// determine partial update time
frac = CL_LerpPoint ();
CL_UpdatePowerUpAngles();
cl_numvisedicts = 0;
cl_numstaticbrushmodels = 0;
//
// interpolate player info
//
for (i=0 ; i<3 ; i++)
cl.velocity[i] = cl.mvelocity[1][i] +
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
cl.velocity[i] = cl.mvelocity[1][i] + frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
if (cls.demoplayback)
{
// interpolate the angles
// interpolate the angles
for (j=0 ; j<3 ; j++)
{
d = cl.mviewangles[0][j] - cl.mviewangles[1][j];
@ -573,7 +632,7 @@ void CL_RelinkEntities (void)
cl.viewangles[j] = cl.mviewangles[1][j] + frac*d;
}
}
// start on the entity after the world
for (i=1,ent=cl_entities+1 ; i<cl.num_entities ; i++,ent++)
{
@ -588,6 +647,10 @@ void CL_RelinkEntities (void)
if (ent->msgtime != cl.mtime[0])
{
ent->model = NULL;
// fenix@io.com: model transform interpolation
ent->frame_start_time = 0;
ent->translate_start_time = 0;
ent->rotate_start_time = 0;
continue;
}
@ -599,7 +662,9 @@ void CL_RelinkEntities (void)
ent->msg_origins[0][2] == 0 &&
ent->msg_angles[0][0] == 0 &&
ent->msg_angles[0][1] == 0 &&
ent->msg_angles[0][2] == 0) {
ent->msg_angles[0][2] == 0 &&
(ent->rendermode == 0 || ent->rendermode == TEX_SOLID || ent->rendermode == TEX_TEXTURE))
{
cl_staticbrushmodels[cl_numstaticbrushmodels] = ent;
cl_numstaticbrushmodels++;
continue;
@ -620,10 +685,19 @@ void CL_RelinkEntities (void)
for (j=0 ; j<3 ; j++)
{
delta[j] = ent->msg_origins[0][j] - ent->msg_origins[1][j];
if (delta[j] > 100 || delta[j] < -100)
if (delta[j] > 100 || delta[j] < -100)//blubs check here for interpolating zombies
f = 1; // assume a teleportation, not a motion
}
// fenix@io.com: model transform interpolation
// interpolation should be reset in the event of a large delta
if (f >= 1)
{
//ent->frame_start_time = 0;
ent->translate_start_time = 0;
ent->rotate_start_time = 0;
}
// interpolate the origin and angles
for (j=0 ; j<3 ; j++)
{
@ -636,10 +710,25 @@ void CL_RelinkEntities (void)
d += 360;
ent->angles[j] = ent->msg_angles[1][j] + f*d;
}
}
/*
if (ent->modelindex == cl_modelindex[mi_explo1] || ent->modelindex == cl_modelindex[mi_explo2])
{
// software removal of sprites
if (r_explosiontype.value == 2 || r_explosiontype.value == 3)
continue;
if (qmb_initialized && r_part_explosions.value)
continue;
}
if (!(model = cl.model_precache[ent->modelindex]))
Host_Error ("CL_RelinkEntities: bad modelindex");
*/
// rotate binary objects locally
if (ent->model->flags & EF_ROTATE) {
ent->angles[0] = mdlflag_poweruprotate_currentangles[0];
ent->angles[1] = mdlflag_poweruprotate_currentangles[1];
@ -648,6 +737,7 @@ void CL_RelinkEntities (void)
if (ent->effects & EF_MUZZLEFLASH)
{
if (i == cl.viewentity && qmb_initialized && r_part_muzzleflash.value)
{
vec3_t start, smokeorg, v_forward, v_right, v_up;
@ -660,7 +750,7 @@ void CL_RelinkEntities (void)
AngleVectors (tempangles, v_forward, v_right, v_up);
VectorCopy (cl_entities[cl.viewentity].origin, smokeorg);
smokeorg[2] += cl.viewheight;
smokeorg[2] += 32;
VectorCopy(smokeorg,start);
right_offset = sv_player->v.Flash_Offset[0];
@ -675,8 +765,14 @@ void CL_RelinkEntities (void)
VectorMA (smokeorg, up_offset, v_up ,smokeorg);
VectorMA (smokeorg, right_offset, v_right ,smokeorg);
VectorAdd(smokeorg,CWeaponOffset,smokeorg);
QMB_MuzzleFlash (smokeorg);
if (sv_player->v.weapon != W_RAY && sv_player->v.weapon != W_PORTER) {
QMB_MuzzleFlash (smokeorg);
} else {
QMB_RayFlash(smokeorg, sv_player->v.weapon);
}
}
}
if (ent->effects & EF_BLUELIGHT)
@ -780,7 +876,7 @@ void CL_RelinkEntities (void)
if (ent->effects & EF_RAYGREEN)
{
QMB_RocketTrail(oldorg, ent->origin, RAYGREEN_TRAIL);
R_RocketTrail (oldorg, ent->origin, 12);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 25;
@ -793,7 +889,7 @@ void CL_RelinkEntities (void)
if (ent->effects & EF_RAYRED)
{
QMB_RocketTrail(oldorg, ent->origin, RAYRED_TRAIL);
R_RocketTrail (oldorg, ent->origin, 13);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 25;
@ -804,6 +900,24 @@ void CL_RelinkEntities (void)
dl->type = SetDlightColor (2, lt_rocket, true);
}
if (!strcmp(ent->model->name, "progs/flame2.mdl"))
{
if (qmb_initialized && r_part_flames.value)
{
//QMB_BigTorchFlame (ent->origin);
if (qmb_initialized && r_part_trails.value)
R_RocketTrail (oldorg, ent->origin, LAVA_TRAIL);
}
}
if ((!strcmp(ent->model->name, "progs/s_spike.mdl"))||(!strcmp(ent->model->name, "progs/spike.mdl")))
{
if (qmb_initialized && r_part_trails.value)
{
R_RocketTrail (oldorg, ent->origin, NAIL_TRAIL);
}
}
if (ent->model->flags)
{
if (ent->model->flags & EF_GIB)
@ -845,26 +959,23 @@ void CL_RelinkEntities (void)
}
// Tomaz - QC Glow End
ent->forcelink = false;
if (i == cl.viewentity && !chase_active.value)
continue;
#ifdef QUAKE2
if ( ent->effects & EF_NODRAW )
continue;
#endif
if (cl_numvisedicts < MAX_VISEDICTS)
{
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
}
}
}
/*
===============
CL_ReadFromServer
@ -878,19 +989,30 @@ int CL_ReadFromServer (void)
cl.oldtime = cl.time;
cl.time += host_frametime;
do
{
ret = CL_GetMessage ();
if (ret == -1)
Host_Error ("CL_ReadFromServer: lost server connection");
if (!ret)
break;
cl.last_received_message = realtime;
CL_ParseServerMessage ();
//if(ret)
//{
//Con_Printf("++++++++++++++Got a new server message!+++++++++\n");
//}
cl.last_received_message = realtime;
//Con_Printf("ParseServerMessage \n");
CL_ParseServerMessage ();
//}
} while (ret && cls.state == ca_connected);
//Con_Printf("-------------Done with server messages---------------=====\n");
if (cl_shownet.value)
Con_Printf ("\n");
@ -919,13 +1041,14 @@ void CL_SendCmd (void)
{
// get basic movement from keyboard
CL_BaseMove (&cmd);
// allow mice or other external controllers to add to the move
if (!in_disable_analog.value)
IN_Move (&cmd);
// send the unreliable message
CL_SendMove (&cmd);
}
if (cls.demoplayback)
@ -933,11 +1056,11 @@ void CL_SendCmd (void)
SZ_Clear (&cls.message);
return;
}
// send the reliable message
if (!cls.message.cursize)
return; // no message at all
if (!NET_CanSendMessage (cls.netcon))
{
Con_DPrintf ("CL_WriteToServer: can't send\n");
@ -956,20 +1079,21 @@ CL_Init
=================
*/
void CL_Init (void)
{
{
SZ_Alloc (&cls.message, 1024);
SList_Init ();
SList_Load ();
CL_InitInput ();
CL_InitTEnts ();
//
// register our commands
//
Cvar_RegisterVariable (&cl_name);
Cvar_RegisterVariable (&cl_color);
Cvar_RegisterVariable (&waypoint_mode);
Cvar_RegisterVariable (&autosave_waypoint);
Cvar_RegisterVariable (&cl_upspeed);
//Cvar_RegisterVariable (&cl_backspeed);
//Cvar_RegisterVariable (&cl_forwardspeed);
Cvar_RegisterVariable (&cl_movespeedkey);
Cvar_RegisterVariable (&cl_yawspeed);
Cvar_RegisterVariable (&cl_pitchspeed);
@ -978,19 +1102,33 @@ void CL_Init (void)
Cvar_RegisterVariable (&cl_nolerp);
Cvar_RegisterVariable (&lookspring);
Cvar_RegisterVariable (&lookstrafe);
Cvar_RegisterVariable (&cl_rocket2grenade);
Cvar_RegisterVariable (&cl_deadbodyfilter);
Cvar_RegisterVariable (&cl_gibfilter);
Cvar_RegisterVariable (&cl_lightning_zadjust);
Cvar_RegisterVariable (&cl_truelightning);
#ifdef __PSP__
Cvar_RegisterVariable (&in_sensitivity);
#else
Cvar_RegisterVariable (&sensitivity);
#endif // __PSP__
Cvar_RegisterVariable (&in_mlook); //Heffo - mlook cvar
Cvar_RegisterVariable (&in_aimassist);
Cvar_RegisterVariable (&in_tolerance);
Cvar_RegisterVariable (&in_acceleration);
Cvar_RegisterVariable (&in_aimassist);
Cvar_RegisterVariable (&in_disable_analog);
Cvar_RegisterVariable (&in_analog_strafe);
Cvar_RegisterVariable (&in_x_axis_adjust);
Cvar_RegisterVariable (&in_y_axis_adjust);
Cvar_RegisterVariable (&m_pitch);
Cvar_RegisterVariable (&m_yaw);
Cvar_RegisterVariable (&m_forward);
Cvar_RegisterVariable (&m_side);
Cvar_RegisterVariable (&in_mlook);
// Cvar_RegisterVariable (&cl_autofire);
Cmd_AddCommand ("entities", CL_PrintEntities_f);
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
Cmd_AddCommand ("record", CL_Record_f);

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -21,10 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
static vec3_t playerbeam_end; // added by joe
int num_temp_entities;
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
beam_t cl_beams[MAX_BEAMS];
model_t *cl_q3gunshot_mod, *cl_q3teleport_mod;
sfx_t *cl_sfx_r_exp3;
extern sfx_t *cl_sfx_step[4];
/*
=================
CL_ParseTEnt
@ -32,7 +39,24 @@ CL_ParseTEnt
*/
void CL_InitTEnts (void)
{
cl_sfx_r_exp3 = S_PrecacheSound ("sounds/weapons/r_exp3.wav");
cl_sfx_step[0] = S_PrecacheSound ("sounds/player/footstep1.wav");
cl_sfx_step[1] = S_PrecacheSound ("sounds/player/footstep2.wav");
cl_sfx_step[2] = S_PrecacheSound ("sounds/player/footstep3.wav");
cl_sfx_step[3] = S_PrecacheSound ("sounds/player/footstep4.wav");
}
/*
=================
CL_ClearTEnts
=================
*/
void CL_ClearTEnts (void)
{
//cl_bolt1_mod = cl_bolt2_mod = cl_bolt3_mod = cl_beam_mod = NULL;
cl_q3gunshot_mod = cl_q3teleport_mod = NULL;
memset (&cl_beams, 0, sizeof(cl_beams));
}
/*
@ -46,17 +70,20 @@ void CL_ParseBeam (model_t *m)
vec3_t start, end;
beam_t *b;
int i;
ent = MSG_ReadShort ();
start[0] = MSG_ReadCoord ();
start[1] = MSG_ReadCoord ();
start[2] = MSG_ReadCoord ();
end[0] = MSG_ReadCoord ();
end[1] = MSG_ReadCoord ();
end[2] = MSG_ReadCoord ();
if (ent == cl.viewentity)
VectorCopy(end, playerbeam_end); // for cl_truelightning
// override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
@ -82,11 +109,24 @@ void CL_ParseBeam (model_t *m)
return;
}
}
Con_Printf ("beam list overflow!\n");
Con_Printf ("beam list overflow!\n");
}
enum
{
DECAL_NONE,
DECAL_BULLTMRK,
DECAL_BLOODMRK1,
DECAL_BLOODMRK2,
DECAL_BLOODMRK3,
DECAL_EXPLOMRK
};
//==============================================================================
extern cvar_t r_decal_bullets;
extern cvar_t r_decal_explosions;
extern int decal_mark;
extern int decal_blood1, decal_blood2, decal_blood3, decal_burn, decal_mark, decal_glow;
//==============================================================================
/*
=================
CL_ParseTEnt
@ -96,11 +136,8 @@ void CL_ParseTEnt (void)
{
int type;
vec3_t pos;
#ifdef QUAKE2
vec3_t endpos;
#endif
dlight_t *dl;
int rnd;
//int rnd;
int colorStart, colorLength;
type = MSG_ReadByte ();
@ -110,37 +147,62 @@ void CL_ParseTEnt (void)
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_part_spikes.value == 2 && !cl_q3gunshot_mod)
cl_q3gunshot_mod = Mod_ForName ("progs/bullet.md3", true);
R_RunParticleEffect (pos, vec3_origin, 20, 30);
//S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
case TE_KNIGHTSPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_part_spikes.value == 2 && !cl_q3gunshot_mod)
cl_q3gunshot_mod = Mod_ForName ("progs/bullet.md3", true);
R_RunParticleEffect (pos, vec3_origin, 226, 20);
//S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLTEST
Test_Spawn (pos);
#else
if (r_part_spikes.value == 2 && !cl_q3gunshot_mod)
cl_q3gunshot_mod = Mod_ForName ("progs/bullet.md3", true);
//R00k--start
if (r_decal_bullets.value)
{
R_SpawnDecalStatic(pos, decal_mark, 8);
}
//R00k--end
R_RunParticleEffect (pos, vec3_origin, 0, 10);
#endif
break;
case TE_SUPERSPIKE: // super spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_part_spikes.value == 2 && !cl_q3gunshot_mod)
cl_q3gunshot_mod = Mod_ForName ("progs/bullet.md3", true);
R_RunParticleEffect (pos, vec3_origin, 0, 20);
//R00k--start
if (r_decal_bullets.value)
{
R_SpawnDecalStatic(pos, decal_mark, 10);
}
//R00k--end
break;
case TE_GUNSHOT: // bullet hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_part_gunshots.value == 2 && !cl_q3gunshot_mod)
cl_q3gunshot_mod = Mod_ForName ("progs/bullet.md3", true);
//R00k--start
if (r_decal_bullets.value)
{
@ -149,19 +211,23 @@ void CL_ParseTEnt (void)
//R00k--end
R_RunParticleEffect (pos, vec3_origin, 0, 20);
break;
case TE_EXPLOSION: // rocket explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_ParticleExplosion (pos);
if (r_decal_explosions.value)
{
R_SpawnDecalStatic(pos, decal_burn, 100);
}
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 0.5);
break;
case TE_RAYSPLASHGREEN:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
@ -192,46 +258,53 @@ void CL_ParseTEnt (void)
R_RunParticleEffect (pos, vec3_origin, 0, 512);
//S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 0.5); // NZPFIXME - add raygun hum
break;
case TE_TAREXPLOSION: // tarbaby explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_BlobExplosion (pos);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
case TE_LIGHTNING1: // lightning bolts
CL_ParseBeam (Mod_ForName("models/misc/bolt.mdl", true));
break;
case TE_LIGHTNING2: // lightning bolts
CL_ParseBeam (Mod_ForName("models/misc/bolt2.mdl", true));
break;
case TE_LIGHTNING3: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt3.mdl", true));
break;
// PGM 01/21/97
// PGM 01/21/97
case TE_BEAM: // grappling hook beam
CL_ParseBeam (Mod_ForName("progs/beam.mdl", true));
break;
// PGM 01/21/97
case TE_LAVASPLASH:
case TE_LAVASPLASH:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
R_LavaSplash (pos);
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150;
dl->die = cl.time + 0.75;
dl->decay = 200;
break;
case TE_TELEPORT:
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if (r_part_telesplash.value == 2 && !cl_q3teleport_mod)
cl_q3teleport_mod = Mod_ForName ("progs/telep.md3", true);
R_TeleportSplash (pos);
break;
case TE_EXPLOSION2: // color mapped explosion
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
@ -239,11 +312,18 @@ void CL_ParseTEnt (void)
colorStart = MSG_ReadByte ();
colorLength = MSG_ReadByte ();
R_ParticleExplosion2 (pos, colorStart, colorLength);
if (r_decal_explosions.value)
{
R_SpawnDecalStatic(pos, decal_burn, 100);
}
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
default:
@ -285,7 +365,7 @@ qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
trace_t trace;
memset (&trace, 0, sizeof(trace));
if (!SV_RecursiveHullCheck(cl.worldmodel->hulls, 0, start, end, &trace))
if (!SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, start, end, &trace))
{
if (trace.fraction < 1)
{
@ -300,6 +380,8 @@ qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
return false;
}
void QMB_Lightning_Splash (vec3_t org);
extern cvar_t scr_ofsy;
/*
=================
CL_UpdateTEnts
@ -309,12 +391,16 @@ void CL_UpdateTEnts (void)
{
int i;
beam_t *b;
vec3_t dist, org;
vec3_t dist, org, beamstart;
float d;
entity_t *ent;
float yaw, pitch;
float forward;
int j;
vec3_t beamend;
// qboolean sparks = false;
num_temp_entities = 0;
// update lightning
@ -323,11 +409,57 @@ void CL_UpdateTEnts (void)
if (!b->model || b->endtime < cl.time)
continue;
// if coming from the player, update the start position
#ifdef __PSP__
// if coming from the player, update the start position
if (b->entity == cl.viewentity)
{
VectorCopy (cl_entities[cl.viewentity].origin, b->start);
b->start[2] += cl.crouch + bound(-7, scr_ofsy.value, 4);
b->start[2] += bound(0, cl_lightning_zadjust.value, 20);//progs.dat aims from 20 for traceline
if (cl_truelightning.value)
{
vec3_t forward, v, org, ang;
float f, delta;
trace_t trace;
f = fmax(0, fmin(1, cl_truelightning.value));
VectorSubtract (playerbeam_end, cl_entities[cl.viewentity].origin, v);
//v[2] -= 22; // adjust for view height
v[2] -= cl.crouch; //
v[2] -= bound(0, cl_lightning_zadjust.value, 20);
vectoangles (v, ang);
// lerp pitch
ang[0] = -ang[0];
if (ang[0] < -180)
ang[0] += 360;
ang[0] += (cl.viewangles[0] - ang[0]) * f;
// lerp yaw
delta = cl.viewangles[1] - ang[1];
if (delta > 180)
delta -= 360;
if (delta < -180)
delta += 360;
ang[1] += delta * f;
ang[2] = 0;
AngleVectors (ang, forward, NULLVEC, NULLVEC);
VectorScale(forward, 600, forward);
VectorCopy(cl_entities[cl.viewentity].origin, org);
org[2] += bound(0, cl_lightning_zadjust.value, 20);//progs.dat aims from 20 for teaceline
VectorAdd(org, forward, b->end);
memset (&trace, 0, sizeof(trace_t));
if (!SV_RecursiveHullCheck(cl.worldmodel->hulls, 0, org, b->end, &trace))
VectorCopy(trace.endpos, b->end);
}
}
#endif // __PSP__
// calculate pitch and yaw
VectorSubtract (b->end, b->start, dist);
@ -342,20 +474,53 @@ void CL_UpdateTEnts (void)
}
else
{
yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI);
yaw = (int) (atan2f(dist[1], dist[0]) * 180 / M_PI);
if (yaw < 0)
yaw += 360;
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
pitch = (int) (atan2(dist[2], forward) * 180 / M_PI);
forward = sqrtf (dist[0]*dist[0] + dist[1]*dist[1]);
pitch = (int) (atan2f(dist[2], forward) * 180 / M_PI);
if (pitch < 0)
pitch += 360;
}
// add new entities for the lightning
VectorCopy(b->start, org);
VectorCopy(b->start, beamstart);
d = VectorNormalize (dist);
VectorScale (dist, 30, dist);
if (key_dest == key_game)
{
for ( ; d > 0 ; d -= 30)
{
if ((qmb_initialized && r_part_lightning.value) && (!cl.paused))
{
VectorAdd(org, dist, beamend);
for (j=0 ; j<3 ; j++)
beamend[j] += ((rand()%10)-5);
QMB_LightningBeam (beamstart, beamend);
//if ((r_glowlg.value) && (r_dynamic.value))
// CL_NewDlight (i, beamstart, 100, 0.1, lt_blue);
VectorCopy(beamend, beamstart);
}
else
{
if (!(ent = CL_NewTempEntity()))
return;
VectorCopy(org, ent->origin);
ent->model = b->model;
ent->angles[0] = pitch;
ent->angles[1] = yaw;
ent->angles[2] = rand() % 360;
}
VectorAdd(org, dist, org);
}
}
/*
// add new entities for the lightning
VectorCopy (b->start, org);
d = VectorNormalize(dist);
while (d > 0)
while (d > 0)
{
ent = CL_NewTempEntity ();
if (!ent)
@ -370,8 +535,9 @@ void CL_UpdateTEnts (void)
org[i] += dist[i]*30;
d -= 30;
}
*/
}
}

View file

@ -64,6 +64,16 @@ int con_notifylines; // scan lines to clear for notify lines
extern void M_Menu_Main_f (void);
#define MAXGAMEDIRLEN 1000
char debuglogfile[MAXGAMEDIRLEN + 1];
#ifdef __PSP__
void M_OSK_Draw (void);
void Con_OSK_f (char *input, char *output, int outlen);
void Con_OSK_Key(int key);
void Con_DrawOSK(void);
#endif // __PSP__
extern qboolean console_enabled;
/*
================
@ -214,18 +224,16 @@ Con_Init
*/
void Con_Init (void)
{
#define MAXGAMEDIRLEN 1000
char temp[MAXGAMEDIRLEN+1];
char *t2 = "/qconsole.log";
char *t2 = "/condebug.log";
con_debuglog = 1;//COM_CheckParm("-condebug");
con_debuglog = COM_CheckParm("-condebug");
if (con_debuglog)
{
if (strlen (com_gamedir) < (MAXGAMEDIRLEN - strlen (t2)))
{
sprintf (temp, "%s%s", com_gamedir, t2);
unlink (temp);
sprintf (debuglogfile, "%s%s", com_gamedir, t2);
unlink (debuglogfile);
}
}
@ -392,7 +400,7 @@ void Con_Printf (char *fmt, ...)
// log all messages to file
if (con_debuglog)
Con_DebugLog(va("%s/qconsole.log",com_gamedir), "%s", msg);
Con_DebugLog(debuglogfile, "%s", msg);
if (!con_initialized)
return;
@ -616,8 +624,32 @@ void Con_DrawConsole (int lines, qboolean drawinput)
// draw the input prompt, user text, and cursor if desired
if (drawinput)
Con_DrawInput ();
#ifdef __PSP__
Con_DrawOSK();
#endif // __PSP__
}
#ifdef __PSP__
static qboolean scr_osk_active = false;
void Con_SetOSKActive(qboolean active)
{
scr_osk_active = active;
}
qboolean Con_isSetOSKActive(void)
{
return scr_osk_active;
}
void Con_DrawOSK(void) {
if (scr_osk_active) {
M_OSK_Draw();
}
}
#endif // __PSP__
/*
==================

61
source/crypter.c Normal file
View file

@ -0,0 +1,61 @@
/*
DATA Decrypt
*/
#include <stdlib.h>
#include <ctype.h>
char rotate(char c, int key)
{
int l = 'Z' - 'A';
c += key % l;
if(c < 'A')
c += l;
if(c > 'Z')
c -= l;
return c;
}
char encrypt(char c, int key)
{
if(c >= 'a' && c <= 'z')
c = toupper(c);
if(c >= 'A' && c <= 'Z')
c = rotate(c, key);
return c;
}
char decrypt(char c, int key)
{
if(c < 'A' || c > 'Z')
return c;
else
return rotate(c, key);
}
void* Q_malloc(size_t);
char *strencrypt(char *s, int key, int len)
{
int i;
char *result = Q_malloc(len);
for(i = 0; i < len; i++)
result[i] = encrypt(s[i], key);
return result;
}
char *strdecrypt(char *s, int key, int len)
{
int i;
char *result = Q_malloc(len);
for(i = 0; i < len; i++)
result[i] = decrypt(s[i], -key);
return result;
}

12
source/crypter.h Normal file
View file

@ -0,0 +1,12 @@
/*
RSA DATA Decrypt
*/
#ifndef RSA_H
#define RSA_H
char *strencrypt(char *s, int key, int len);
char *strdecrypt(char *s, int key, int len);
#endif

View file

@ -866,7 +866,7 @@ void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a)
glDisable (GL_TEXTURE_2D);
glEnable (GL_BLEND); //johnfitz -- for alpha
glDisable (GL_ALPHA_TEST); //johnfitz -- for alpha
glColor4f (r/255, g/255, b/255, a/255);
glColor4f ((float)(r/255.0f), (float)(g/255.0f), (float)(b/255.0f), (float)(a/255.0f));
glBegin (GL_QUADS);

View file

@ -350,9 +350,6 @@ typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define EF_TRACER2 64 // orange split trail + rotate
#define EF_TRACER3 128 // purple trail
//johnfitz -- extra flags for rendering
#define MOD_NOLERP 256
//johnfits
// some models are special
typedef enum

View file

@ -2174,6 +2174,29 @@ float pap_detr(int weapon)
}
}
// cypress - Raygun barrel trail
void QMB_RayFlash(vec3_t org, float weapon)
{
// if we're ADS, just flat out end here to avoid useless calcs/defs
if (cl.stats[STAT_ZOOM] || !qmb_initialized)
return;
col_t color;
vec3_t endorg;
// green trail
if (weapon == W_RAY) {
color[0] = 0;
color[1] = 255;
} else { // red trail
color[0] = 255;
color[1] = 0;
}
color[2] = 0;
QMB_MuzzleFlash(org);
}
//R00k added particle muzzleflashes
qboolean red_or_blue_pap;
void QMB_MuzzleFlash(vec3_t org)

View file

@ -84,8 +84,6 @@ cvar_t r_mirroralpha = {"r_mirroralpha","1"};
cvar_t r_wateralpha = {"r_wateralpha","1"};
cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
cvar_t r_lerpmodels = {"r_lerpmodels", "1"};
cvar_t r_lerpmove = {"r_lerpmove", "1"};
cvar_t r_skyfog = {"r_skyfog", "1"};
cvar_t gl_finish = {"gl_finish","0"};
@ -126,16 +124,6 @@ cvar_t r_farclip = {"r_farclip", "4096"}; //far clip
cvar_t r_flatlightstyles = {"r_flatlightstyles", "0", qfalse};
//johnfitz -- struct for passing lerp information to drawing functions
typedef struct {
short pose1;
short pose2;
float blend;
vec3_t origin;
vec3_t angles;
} lerpdata_t;
//johnfitz
extern cvar_t gl_ztrick;
extern cvar_t scr_fov_viewmodel;
@ -171,6 +159,126 @@ void R_RotateForEntity (entity_t *e, unsigned char scale)
}
}
void IgnoreInterpolatioFrame (entity_t *e, aliashdr_t *paliashdr)
{
if (strcmp(e->old_model, e->model->name) && e->model != NULL)
{
strcpy(e->old_model, e->model->name);
// fenix@io.com: model transform interpolation
e->frame_start_time = 0;
e->translate_start_time = 0;
e->rotate_start_time = 0;
e->pose1 = 0;
e->pose2 = paliashdr->frames[e->frame].firstpose;
}
}
/*
=============
R_InterpolateEntity
was R_BlendedRotateForEntity
fenix@io.com: model transform interpolation
modified by blubswillrule
//fixme (come back and fix this once we can test on psp and view the true issue with interpolation)
=============
*/
void R_InterpolateEntity(entity_t *e, int shadow) // Tomaz - New Shadow
{
float timepassed;
float blend;
vec3_t deltaVec;
int i;
// positional interpolation
timepassed = realtime - e->translate_start_time;
//notes to self (blubs)
//-Added this method, and commented out the check for r_i_model_transforms.value
//tried the snapping interpolation, though it worked, it was still a bit jittery...
//problem with linear interpolation is we don't know the exact time it should take to move from origin1 to origin2...
//looks like the rotation interpolation doesn't work all that great either, rotation could benefit from the snapping interpolation that I use
//if I get this method to work well, make sure we go back and check for r_i_model_transforms again, (because vmodel and other models that don't use interpolation)
//probably go back and edit animations too as I redo the last 2 textures..
if (e->translate_start_time == 0 || timepassed > 1)
{
e->translate_start_time = realtime;
VectorCopy (e->origin, e->origin1);
VectorCopy (e->origin, e->origin2);
}
//our origin has been updated
if (!VectorCompare (e->origin, e->origin2))
{
e->translate_start_time = realtime;
VectorCopy (e->origin2, e->origin1);
VectorCopy (e->origin, e->origin2);
blend = 0;
}
else
{
blend = timepassed / 0.4;//0.1 not sure what this value should be...
//technically this value should be the total amount of time that we take from 1 position to the next, it's practically how long it should take us to go from one location to the next...
if (cl.paused || blend > 1)
blend = 0;
}
VectorSubtract (e->origin2, e->origin1, deltaVec);
glTranslatef (e->origin[0] + (blend * deltaVec[0]), e->origin[1] + (blend * deltaVec[1]), e->origin[2] + (blend * deltaVec[2]));
// orientation interpolation (Euler angles, yuck!)
timepassed = realtime - e->rotate_start_time;
if (e->rotate_start_time == 0 || timepassed > 1)
{
e->rotate_start_time = realtime;
VectorCopy (e->angles, e->angles1);
VectorCopy (e->angles, e->angles2);
}
if (!VectorCompare (e->angles, e->angles2))
{
e->rotate_start_time = realtime;
VectorCopy (e->angles2, e->angles1);
VectorCopy (e->angles, e->angles2);
blend = 0;
}
else
{
blend = timepassed / 0.1;
if (cl.paused || blend > 1)
blend = 1;
}
VectorSubtract (e->angles2, e->angles1, deltaVec);
// always interpolate along the shortest path
for (i = 0; i < 3; i++)
{
if (deltaVec[i] > 180)
{
deltaVec[i] -= 360;
}
else if (deltaVec[i] < -180)
{
deltaVec[i] += 360;
}
}
glRotatef ((e->angles1[YAW] + ( blend * deltaVec[YAW])) * (M_PI / 180.0f), 0, 0, 1);
if (shadow == 0)
{
glRotatef ((-e->angles1[PITCH] + (-blend * deltaVec[PITCH])) * (M_PI / 180.0f), 0, 1, 0);
glRotatef ((e->angles1[ROLL] + ( blend * deltaVec[ROLL])) * (M_PI / 180.0f), 1, 0, 0);
}
}
/*
=================
R_FrustumCheckBox
@ -361,34 +469,84 @@ int lastposenum;
GL_DrawAliasFrame -- johnfitz -- rewritten to support colored light, lerping, entalpha, multitexture, and r_drawflat
=============
*/
void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
{
float vertcolor[4];
trivertx_t *verts1, *verts2;
trivertx_t *verts;
int *commands;
int count;
float u,v;
float blend, iblend;
qboolean lerping;
if (lerpdata.pose1 != lerpdata.pose2)
verts = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
verts += posenum * paliashdr->poseverts;
commands = (int *)((byte *)paliashdr + paliashdr->commands);
glColor4f(lightcolor[0]/255, lightcolor[1]/255, lightcolor[2]/255, 1.0f);
while (1)
{
lerping = true;
verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
verts2 = verts1;
verts1 += lerpdata.pose1 * paliashdr->poseverts;
verts2 += lerpdata.pose2 * paliashdr->poseverts;
blend = lerpdata.blend;
iblend = 1.0f - blend;
}
else // poses the same means either 1. the entity has paused its animation, or 2. r_lerpmodels is disabled
{
lerping = false;
verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
verts2 = verts1; // avoid bogus compiler warning
verts1 += lerpdata.pose1 * paliashdr->poseverts;
blend = iblend = 0; // avoid bogus compiler warning
// get the vertex count and primitive type
count = *commands++;
if (!count)
break; // done
if (count < 0)
{
count = -count;
glBegin (GL_TRIANGLE_FAN);
}
else
glBegin (GL_TRIANGLE_STRIP);
do
{
u = ((float *)commands)[0];
v = ((float *)commands)[1];
glTexCoord2f (u, v);
commands += 2;
glVertex3f (verts->v[0], verts->v[1], verts->v[2]);
verts++;
} while (--count);
glEnd ();
}
}
/*
=============
GL_DrawAliasBlendedFrame
fenix@io.com: model animation interpolation
=============
*/
// fenix@io.com: model animation interpolation
int lastposenum0;
void GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float blend)
{
// if (r_showtris.value)
// {
// GL_DrawAliasBlendedWireFrame(paliashdr, pose1, pose2, blend);
// return;
// }
trivertx_t* verts1;
trivertx_t* verts2;
vec3_t d;
int *commands;
int count;
float u,v;
lastposenum0 = pose1;
lastposenum = pose2;
verts1 = (trivertx_t *)((byte *)paliashdr + paliashdr->posedata);
verts2 = verts1;
verts1 += pose1 * paliashdr->poseverts;
verts2 += pose2 * paliashdr->poseverts;
commands = (int *)((byte *)paliashdr + paliashdr->commands);
@ -418,23 +576,16 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
commands += 2;
if (lerping) {
glVertex3f (verts1->v[0]*iblend + verts2->v[0]*blend,
verts1->v[1]*iblend + verts2->v[1]*blend,
verts1->v[2]*iblend + verts2->v[2]*blend);
verts1++;
verts2++;
} else {
glVertex3f (verts1->v[0], verts1->v[1], verts1->v[2]);
verts1++;
}
VectorSubtract(verts2->v, verts1->v, d);
glVertex3f (verts1->v[0] + (blend * d[0]), verts1->v[1] + (blend * d[1]), verts1->v[2] + (blend * d[2]));
verts1++;
verts2++;
} while (--count);
glEnd ();
}
}
/*
=============
GL_DrawAliasShadow
@ -506,17 +657,50 @@ void GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
/*
=================
R_SetupAliasFrame -- johnfitz -- rewritten to support lerping
R_SetupAliasFrame
=================
*/
void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata)
void R_SetupAliasFrame (int frame, aliashdr_t *paliashdr)
{
entity_t *e = currententity;
int posenum, numposes;
int pose, numposes;
float interval;
if ((frame >= paliashdr->numframes) || (frame < 0))
{
Con_DPrintf ("R_AliasSetupFrame: no such frame %d for '%s'\n", frame, e->model->name);
Con_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame);
frame = 0;
}
pose = paliashdr->frames[frame].firstpose;
numposes = paliashdr->frames[frame].numposes;
if (numposes > 1)
{
interval = paliashdr->frames[frame].interval;
pose += (int)(cl.time / interval) % numposes;
}
GL_DrawAliasFrame(paliashdr, pose);
}
/*
=================
R_SetupAliasBlendedFrame
fenix@io.com: model animation interpolation
=================
*/
//double t1, t2, t3;
void R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t* e)
{
int pose;
int numposes;
float blend;
if ((frame >= paliashdr->numframes) || (frame < 0))
{
Con_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame);
frame = 0;
}
@ -527,127 +711,48 @@ void R_SetupAliasFrame (aliashdr_t *paliashdr, int frame, lerpdata_t *lerpdata)
int distance_from_client = (int)((dist_x) * (dist_x) + (dist_y) * (dist_y)); // no use sqrting, just slows us down.
// They're too far away from us to care about blending their frames.
// cypress -- added an additional check not to lerp if there's only 1 frame
if (distance_from_client >= 40000 || paliashdr->numframes <= 1) { // 200 * 200
if (distance_from_client >= 160000) { // 400 * 400
// Fix them from jumping from last lerp
lerpdata->pose1 = lerpdata->pose2 = paliashdr->frames[frame].firstpose;
e->pose1 = e->pose2 = paliashdr->frames[frame].firstpose;
e->frame_interval = 0.1;
e->lerptime = 0.1;
lerpdata->blend = 1;
GL_DrawAliasFrame (paliashdr, paliashdr->frames[frame].firstpose);
} else {
posenum = paliashdr->frames[frame].firstpose;
pose = paliashdr->frames[frame].firstpose;
numposes = paliashdr->frames[frame].numposes;
if (numposes > 1)
{
e->lerptime = paliashdr->frames[frame].interval;
posenum += (int)(cl.time / e->lerptime) % numposes;
e->frame_interval = paliashdr->frames[frame].interval;
pose += (int)(cl.time / e->frame_interval) % numposes;
}
else
e->lerptime = 0.1;
if (e->lerpflags & LERP_RESETANIM) //kill any lerp in progress
{
e->lerpstart = 0;
e->previouspose = posenum;
e->currentpose = posenum;
e->lerpflags -= LERP_RESETANIM;
}
else if (e->currentpose != posenum) // pose changed, start new lerp
{
if (e->lerpflags & LERP_RESETANIM2) //defer lerping one more time
{
e->lerpstart = 0;
e->previouspose = posenum;
e->currentpose = posenum;
e->lerpflags -= LERP_RESETANIM2;
}
else
{
e->lerpstart = cl.time;
e->previouspose = e->currentpose;
e->currentpose = posenum;
}
/* One tenth of a second is a good for most Quake animations.
If the nextthink is longer then the animation is usually meant to pause
(e.g. check out the shambler magic animation in shambler.qc). If its
shorter then things will still be smoothed partly, and the jumps will be
less noticable because of the shorter time. So, this is probably a good
assumption. */
e->frame_interval = 0.1;
}
//set up values
if (r_lerpmodels.value && !(e->model->flags & MOD_NOLERP && r_lerpmodels.value != 2))
if (e->pose2 != pose)
{
if (e->lerpflags & LERP_FINISH && numposes == 1)
lerpdata->blend = CLAMP (0, (cl.time - e->lerpstart) / (e->lerpfinish - e->lerpstart), 1);
else
lerpdata->blend = CLAMP (0, (cl.time - e->lerpstart) / e->lerptime, 1);
lerpdata->pose1 = e->previouspose;
lerpdata->pose2 = e->currentpose;
e->frame_start_time = realtime;
e->pose1 = e->pose2;
e->pose2 = pose;
blend = 0;
}
else //don't lerp
{
lerpdata->blend = 1;
lerpdata->pose1 = posenum;
lerpdata->pose2 = posenum;
}
}
}
/*
=================
R_SetupEntityTransform -- johnfitz -- set up transform part of lerpdata
=================
*/
void R_SetupEntityTransform (entity_t *e, lerpdata_t *lerpdata)
{
float blend;
vec3_t d;
int i;
// if LERP_RESETMOVE, kill any lerps in progress
if (e->lerpflags & LERP_RESETMOVE)
{
e->movelerpstart = 0;
VectorCopy (e->origin, e->previousorigin);
VectorCopy (e->origin, e->currentorigin);
VectorCopy (e->angles, e->previousangles);
VectorCopy (e->angles, e->currentangles);
e->lerpflags -= LERP_RESETMOVE;
}
else if (!VectorCompare (e->origin, e->currentorigin) || !VectorCompare (e->angles, e->currentangles)) // origin/angles changed, start new lerp
{
e->movelerpstart = cl.time;
VectorCopy (e->currentorigin, e->previousorigin);
VectorCopy (e->origin, e->currentorigin);
VectorCopy (e->currentangles, e->previousangles);
VectorCopy (e->angles, e->currentangles);
}
//set up values
if (r_lerpmove.value && e != &cl.viewent && e->lerpflags & LERP_MOVESTEP)
{
if (e->lerpflags & LERP_FINISH)
blend = CLAMP (0, (cl.time - e->movelerpstart) / (e->lerpfinish - e->movelerpstart), 1);
else
blend = CLAMP (0, (cl.time - e->movelerpstart) / 0.1, 1);
blend = (realtime - e->frame_start_time) / e->frame_interval;
// wierd things start happening if blend passes 1
if (cl.paused || blend > 1) blend = 1;
//translation
VectorSubtract (e->currentorigin, e->previousorigin, d);
lerpdata->origin[0] = e->previousorigin[0] + d[0] * blend;
lerpdata->origin[1] = e->previousorigin[1] + d[1] * blend;
lerpdata->origin[2] = e->previousorigin[2] + d[2] * blend;
//rotation
VectorSubtract (e->currentangles, e->previousangles, d);
for (i = 0; i < 3; i++)
{
if (d[i] > 180) d[i] -= 360;
if (d[i] < -180) d[i] += 360;
}
lerpdata->angles[0] = e->previousangles[0] + d[0] * blend;
lerpdata->angles[1] = e->previousangles[1] + d[1] * blend;
lerpdata->angles[2] = e->previousangles[2] + d[2] * blend;
}
else //don't lerp
{
VectorCopy (e->origin, lerpdata->origin);
VectorCopy (e->angles, lerpdata->angles);
if (blend == 1)
GL_DrawAliasFrame (paliashdr, pose);
else
GL_DrawAliasBlendedFrame (paliashdr, e->pose1, e->pose2, blend);
}
}
@ -665,7 +770,6 @@ void R_DrawZombieLimb (entity_t *e, int which)
model_t *clmodel;
aliashdr_t *paliashdr;
entity_t *limb_ent;
lerpdata_t lerpdata;
switch(which) {
case 1:
@ -716,9 +820,8 @@ void R_DrawZombieLimb (entity_t *e, int which)
if (gl_affinemodels.value)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
R_SetupAliasFrame (paliashdr, e->frame, &lerpdata);
R_SetupEntityTransform (e, &lerpdata);
GL_DrawAliasFrame(paliashdr, lerpdata);
IgnoreInterpolatioFrame(e, paliashdr);
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, e);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@ -748,7 +851,6 @@ void R_DrawTransparentAliasModel (entity_t *e)
int index;
float s, t, an;
int anim;
lerpdata_t lerpdata;
clmodel = currententity->model;
@ -841,9 +943,8 @@ void R_DrawTransparentAliasModel (entity_t *e)
if (gl_affinemodels.value)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
R_SetupAliasFrame (paliashdr, e->frame, &lerpdata);
R_SetupEntityTransform (e, &lerpdata);
GL_DrawAliasFrame(paliashdr, lerpdata);
IgnoreInterpolatioFrame(e, paliashdr);
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, e);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDepthMask(GL_TRUE);
@ -892,7 +993,6 @@ void R_DrawAliasModel (entity_t *e)
int index;
float s, t, an;
int anim;
lerpdata_t lerpdata;
clmodel = currententity->model;
@ -1080,9 +1180,8 @@ void R_DrawAliasModel (entity_t *e)
if (gl_affinemodels.value)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
R_SetupAliasFrame (paliashdr, e->frame, &lerpdata);
R_SetupEntityTransform (e, &lerpdata);
GL_DrawAliasFrame(paliashdr, lerpdata);
IgnoreInterpolatioFrame(e, paliashdr);
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, e);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

View file

@ -215,8 +215,6 @@ void R_Init (void)
Cvar_RegisterVariable (&r_dynamic);
Cvar_RegisterVariable (&r_novis);
Cvar_RegisterVariable (&r_speeds);
Cvar_RegisterVariable (&r_lerpmodels);
Cvar_RegisterVariable (&r_lerpmove);
Cvar_RegisterVariable (&r_farclip);

View file

@ -236,8 +236,6 @@ extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha;
extern cvar_t r_dynamic;
extern cvar_t r_novis;
extern cvar_t r_lerpmodels;
extern cvar_t r_lerpmove;
extern cvar_t r_farclip;
extern cvar_t r_skyfog;
@ -361,6 +359,7 @@ void QMB_LightningBeam (vec3_t start, vec3_t end);
//void QMB_GenSparks (vec3_t org, byte col[3], float count, float size, float life);
void QMB_EntityParticles (entity_t *ent);
void QMB_MuzzleFlash (vec3_t org);
void QMB_RayFlash (vec3_t org, float weapon);
void QMB_MuzzleFlashLG (vec3_t org);
void QMB_Q3Gunshot (vec3_t org, int skinnum, float alpha);
void QMB_Q3Teleport (vec3_t org, float alpha);

View file

@ -855,6 +855,10 @@ Host_Init
*/
#include "cl_slist.h"
#ifdef _3DS
extern bool new3ds_flag;
#endif // _3DS
void M_Start_Menu_f (void);
void Host_Init (quakeparms_t *parms)
{
@ -893,7 +897,7 @@ void Host_Init (quakeparms_t *parms)
Con_Printf ("%4.1f megabyte PSP application heap \n",1.0f*PSP_HEAP_SIZE_MB);
Con_Printf ("PSP Model: %s\n", Sys_GetPSPModel());
Con_Printf ("VRAM Size: %i bytes\n", sceGeEdramGetSize());
#elif __3DS
#elif _3DS
Con_Printf ("3DS NZP v%4.1f (3DSX: "__TIME__" "__DATE__")\n", (float)(VERSION));
if (new3ds_flag)

View file

@ -32,4 +32,6 @@ void IN_Move (usercmd_t *cmd);
void IN_ClearStates (void);
// restores all button and position states to defaults
void IN_SwitchKeyboard (void);
#ifdef _3DS
void IN_SwitchKeyboard (void);
#endif // _3DS

View file

@ -71,8 +71,6 @@ extern cvar_t r_numsurfs;
extern cvar_t r_reportedgeout;
extern cvar_t r_maxedges;
extern cvar_t r_numedges;
extern cvar_t r_lerpmodels;
extern cvar_t r_lerpmove;
#define XCENTERING (1.0 / 2.0)
#define YCENTERING (1.0 / 2.0)

View file

@ -35,14 +35,6 @@ typedef struct efrag_s
struct efrag_s *entnext;
} efrag_t;
//johnfitz -- for lerping
#define LERP_MOVESTEP (1<<0) //this is a MOVETYPE_STEP entity, enable movement lerp
#define LERP_RESETANIM (1<<1) //disable anim lerping until next anim frame
#define LERP_RESETANIM2 (1<<2) //set this and previous flag to disable anim lerping for two anim frames
#define LERP_RESETMOVE (1<<3) //disable movement lerping until next origin/angles change
#define LERP_FINISH (1<<4) //use lerpfinish time from server update instead of assuming interval of 0.1
//johnfitz
typedef struct entity_s
{
qboolean forcelink; // model changed
@ -65,6 +57,7 @@ typedef struct entity_s
unsigned char scale;
struct model_s *model; // NULL = no model
char old_model[128]; // NULL = no model
struct efrag_s *efrag; // linked list of efrags
int frame;
float syncbase; // for client-side animations
@ -73,6 +66,15 @@ typedef struct entity_s
int skinnum; // for Alias models
int visframe; // last frame this entity was
// found in an active leaf
// fenix@io.com: model transform interpolation
float translate_start_time;
vec3_t origin1;
vec3_t origin2;
float rotate_start_time;
vec3_t angles1;
vec3_t angles2;
int dlightframe; // dynamic lighting
int dlightbits;
@ -83,18 +85,10 @@ typedef struct entity_s
// that splits bmodel, or NULL if
// not split
byte lerpflags; //johnfitz -- lerping
float lerpstart; //johnfitz -- animation lerping
float lerptime; //johnfitz -- animation lerping
float lerpfinish; //johnfitz -- lerping -- server sent us a more accurate interval, use it instead of 0.1
short previouspose; //johnfitz -- animation lerping
short currentpose; //johnfitz -- animation lerping
// short futurepose; //johnfitz -- animation lerping
float movelerpstart; //johnfitz -- transform lerping
vec3_t previousorigin; //johnfitz -- transform lerping
vec3_t currentorigin; //johnfitz -- transform lerping
vec3_t previousangles; //johnfitz -- transform lerping
vec3_t currentangles; //johnfitz -- transform lerping
float frame_start_time;
float frame_interval;
int pose1;
int pose2;
int modelindex;

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -22,6 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#ifdef __PSP__
#include <pspgu.h>
#include <pspmath.h>
#endif // __PSP__
sfx_t *cl_sfx_step[4];
/*
@ -67,8 +72,6 @@ cvar_t v_idlescale = {"v_idlescale", "0", false};
cvar_t crosshair = {"crosshair", "1", true};
cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false}; //naievil -- wtf is this?
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
extern int in_forward, in_forward2, in_back;
@ -122,7 +125,7 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing
float sprint = 1;
if (cl.stats[STAT_ZOOM] == 2)
return;
return bob;
// Bob idle-y, instead of presenting as if in-motion.
if (speed < 0.1) {
@ -131,10 +134,22 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing
else
speed = 0.25;
#ifdef PSP_VFPU
if (which == 0)
bob = cl_bobup.value * 10 * speed * (sprint * sprint) * sin(cl.time * 3.25 * sprint);
else
bob = cl_bobside.value * 50 * speed * (sprint * sprint * sprint) * sin((cl.time * sprint) - (M_PI * 0.25));
bob = cl_bobup.value * 10 * speed * (sprint * sprint) * vfpu_sinf(cl.time * 3.25 * sprint);
else
bob = cl_bobside.value * 50 * speed * (sprint * sprint * sprint) * vfpu_sinf((cl.time * sprint) - (M_PI * 0.25));
#else
if (which == 0)
bob = cl_bobup.value * 10 * speed * (sprint * sprint) * sin(cl.time * 3.25 * sprint);
else
bob = cl_bobside.value * 50 * speed * (sprint * sprint * sprint) * sin((cl.time * sprint) - (M_PI * 0.25));
#endif // PSP_VFPU
}
// Normal walk/sprint bob.
else {
@ -142,10 +157,23 @@ float V_CalcBob (float speed,float which)//0 = regular, 1 = side bobbing
sprint = 1.8; //this gets sprinting speed in comparison to walk speed per weapon
//12.048 -> 4.3 = 100 -> 36ish, so replace 100 with 36
#ifdef PSP_VFPU
if(which == 0)
bob = cl_bobup.value * 24 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10
bob = cl_bobup.value * 36 * speed * (sprint * sprint) * vfpu_sinf((cl.time * 12.5 * sprint));//Pitch Bobbing 10
else if(which == 1)
bob = cl_bobside.value * 24 * speed * (sprint * sprint * sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5
bob = cl_bobside.value * 36 * speed * (sprint * sprint * sprint) * vfpu_sinf((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5
#else
if(which == 0)
bob = cl_bobup.value * 36 * speed * (sprint * sprint) * sin((cl.time * 12.5 * sprint));//Pitch Bobbing 10
else if(which == 1)
bob = cl_bobside.value * 36 * speed * (sprint * sprint * sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//Yaw Bobbing 5
#endif // PSP_VFPU
}
return bob;
@ -197,32 +225,58 @@ float V_CalcVBob(float speed, float which)
if(sprint == 1)
{
#ifdef PSP_VFPU
if(which == 0)
bob = speed * 8.6 * (1/sprint) * vfpu_sinf((cl.time * 12.5 * sprint));//10
else if(which == 1)
bob = speed * 8.6 * (1/sprint) * vfpu_sinf((cl.time * 6.25 * sprint) - (M_PI * 0.25));//5
else if(which == 2)
bob = speed * 8.6 * (1/sprint) * vfpu_sinf((cl.time * 6.25 * sprint) - (M_PI * 0.25));//5
#else
if(which == 0)
bob = speed * 8.6 * (1/sprint) * sin((cl.time * 12.5 * sprint));//10
else if(which == 1)
bob = speed * 8.6 * (1/sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//5
else if(which == 2)
bob = speed * 8.6 * (1/sprint) * sin((cl.time * 6.25 * sprint) - (M_PI * 0.25));//5
#endif
}
else
{
#ifdef PSP_VFPU
if(which == 0)
bob = speed * 8.6 * (1/sprint) * vfpu_cosf((cl.time * 6.25 * sprint));
else if(which == 1)
bob = speed * 8.6 * (1/sprint) * vfpu_cosf((cl.time * 12.5 * sprint));
else if(which == 2)
bob = speed * 8.6 * (1/sprint) * vfpu_cosf((cl.time * 6.25 * sprint));
#else
if(which == 0)
bob = speed * 8.6 * (1/sprint) * cos((cl.time * 6.25 * sprint));
else if(which == 1)
bob = speed * 8.6 * (1/sprint) * cos((cl.time * 12.5 * sprint));
else if(which == 2)
bob = speed * 8.6 * (1/sprint) * cos((cl.time * 6.25 * sprint));
#endif
}
if(speed > 0.1 && which == 0)
{
#ifdef PSP_VFPU
if(canStep && vfpu_sinf(cl.time * 12.5 * sprint) < -0.8)
#else
if(canStep && sin(cl.time * 12.5 * sprint) < -0.8)
#endif
{
PlayStepSound();
canStep = 0;
}
#ifdef PSP_VFPU
if(vfpu_sinf(cl.time * 12.5 * sprint) > 0.9)
#else
if(sin(cl.time * 12.5 * sprint) > 0.9)
#endif
{
canStep = 1;
}
@ -233,9 +287,6 @@ float V_CalcVBob(float speed, float which)
//=============================================================================
//=============================================================================
cvar_t v_centermove = {"v_centermove", "0.15", false};
cvar_t v_centerspeed = {"v_centerspeed","500"};
@ -273,7 +324,7 @@ If the user is adjusting pitch manually, either with lookup/lookdown,
mlook and mouse, or klook and keyboard, pitch drifting is constantly stopped.
Drifting is enabled when the center view key is hit, mlook is released and
lookspring is non 0, or when
lookspring is non 0, or when
===============
*/
void V_DriftPitch (void)
@ -290,18 +341,18 @@ void V_DriftPitch (void)
// don't count small mouse motion
if (cl.nodrift)
{
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed)
if ( fabsf(cl.cmd.forwardmove) < cl_forwardspeed)
cl.driftmove = 0;
else
cl.driftmove += host_frametime;
if ( cl.driftmove > v_centermove.value)
{
V_StartPitchDrift ();
}
return;
}
delta = cl.idealpitch - cl.viewangles[PITCH];
if (!delta)
@ -312,7 +363,7 @@ void V_DriftPitch (void)
move = host_frametime * cl.pitchvel;
cl.pitchvel += host_frametime * v_centerspeed.value;
//Con_Printf ("move: %f (%f)\n", move, host_frametime);
if (delta > 0)
@ -340,20 +391,20 @@ void V_DriftPitch (void)
/*
==============================================================================
PALETTE FLASHES
==============================================================================
*/
==============================================================================
PALETTE FLASHES
==============================================================================
*/
cshift_t cshift_empty = { {130,80,50}, 0 };
cshift_t cshift_water = { {130,80,50}, 128 };
cshift_t cshift_slime = { {0,25,5}, 150 };
cshift_t cshift_lava = { {255,80,0}, 150 };
cvar_t v_gamma = {"gamma", "1.0", true};
cvar_t v_gamma = {"gamma", "1", true};
byte gammatable[256]; // palette is sent through this
@ -387,93 +438,20 @@ void BuildGammaTable (float g)
V_CheckGamma
=================
*/
static float oldgammavalue;
qboolean V_CheckGamma (void)
{
static float oldgammavalue;
if (v_gamma.value == oldgammavalue)
return false;
oldgammavalue = v_gamma.value;
BuildGammaTable (v_gamma.value);
vid.recalc_refdef = 1; // force a surface cache flush
return true;
}
/*
===============
V_ParseDamage
===============
*/
void V_ParseDamage (void)
{
int armor, blood;
vec3_t from;
int i;
vec3_t forward, right, up;
entity_t *ent;
float side;
float count;
armor = MSG_ReadByte ();
blood = MSG_ReadByte ();
for (i=0 ; i<3 ; i++)
from[i] = MSG_ReadCoord ();
count = blood*0.5 + armor*0.5;
if (count < 10)
count = 10;
cl.faceanimtime = cl.time + 0.2; // but sbar face into pain frame
cl.cshifts[CSHIFT_DAMAGE].percent += 3*count;
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
cl.cshifts[CSHIFT_DAMAGE].percent = 150;
if (armor > blood)
{
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 100;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 100;
}
else if (armor)
{
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 220;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 50;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 50;
}
else
{
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 255;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 0;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
}
//
// calculate view angle kicks
//
ent = &cl_entities[cl.viewentity];
VectorSubtract (from, ent->origin, from);
VectorNormalize (from);
AngleVectors (ent->angles, forward, right, up);
side = DotProduct (from, right);
v_dmg_roll = count*side*v_kickroll.value;
side = DotProduct (from, forward);
v_dmg_pitch = count*side*v_kickpitch.value;
v_dmg_time = v_kicktime.value;
}
/*
==================
V_cshift_f
@ -512,23 +490,41 @@ Underwater, lava, etc each has a color shift
*/
void V_SetContentsColor (int contents)
{
//int s, e, r, g, b, a;
switch (contents)
{
case CONTENTS_EMPTY:
case CONTENTS_SOLID:
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
break;
case CONTENTS_LAVA:
cl.cshifts[CSHIFT_CONTENTS] = cshift_lava;
break;
case CONTENTS_SLIME:
cl.cshifts[CSHIFT_CONTENTS] = cshift_slime;
break;
default:
cl.cshifts[CSHIFT_CONTENTS] = cshift_water;
}
}
default:
cl.cshifts[CSHIFT_CONTENTS] = cshift_water;
break;
}
/*
s = 0;
e = 400;
r = 130;
g = 80;
b = 50;
a = r_wateralpha.value * 255.0f;
if (contents!=CONTENTS_EMPTY||contents!=CONTENTS_SOLID)
{
sceGuEnable(GU_FOG);
sceGuFog (s, e, GU_COLOR( r * 0.01f, g * 0.01f, b * 0.01f, a * 0.01f));
}
*/
}
/*
=============
@ -584,9 +580,12 @@ void V_CalcBlend (void)
for (j=0 ; j<NUM_CSHIFTS ; j++)
{
if (!gl_polyblend.value) {
#ifdef __PSP__
if (!r_polyblend.value)
#else
if (!gl_polyblend.value)
#endif // __PSP__
continue;
}
a2 = cl.cshifts[j].percent / 255.0;
// a2 = cl.cshifts[j].percent/255.0;
@ -1270,26 +1269,26 @@ void V_CalcRefdef (void)
VectorAdd (r_refdef.viewangles, cl.gun_kick, r_refdef.viewangles);
// smooth out stair step ups
if (cl.onground && ent->origin[2] - oldz > 0)
{
float steptime;
// smooth out stair step ups
if (cl.onground && ent->origin[2] - oldz > 0)
{
float steptime;
steptime = cl.time - cl.oldtime;
if (steptime < 0)
//FIXME I_Error ("steptime < 0");
steptime = 0;
steptime = cl.time - cl.oldtime;
if (steptime < 0)
//FIXME I_Error ("steptime < 0");
steptime = 0;
oldz += steptime * 80;
if (oldz > ent->origin[2])
oldz += steptime * 80;
if (oldz > ent->origin[2])
oldz = ent->origin[2];
if (ent->origin[2] - oldz > 12)
oldz = ent->origin[2] - 12;
r_refdef.vieworg[2] += oldz - ent->origin[2];
view->origin[2] += oldz - ent->origin[2];
}
else
oldz = ent->origin[2];
if (ent->origin[2] - oldz > 12)
oldz = ent->origin[2] - 12;
r_refdef.vieworg[2] += oldz - ent->origin[2];
view->origin[2] += oldz - ent->origin[2];
}
else
oldz = ent->origin[2];
if (chase_active.value)
Chase_Update ();
@ -1663,40 +1662,39 @@ void V_RenderView (void)
if (cl.intermission)
{ // intermission / finale rendering
V_CalcIntermissionRefdef ();
V_CalcIntermissionRefdef ();
}
else
{
if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ )
if (!cl.paused && (cl.maxclients > 1 || key_dest == key_game) )
{
V_CalcRefdef ();
}
}
R_PushDlights ();
if (lcd_x.value)
if (lcd_x.value)//blubs: psp doesn't appear to use these
{
//
// render two interleaved views
//
int i;
vid.rowbytes <<= 1;
vid.aspect *= 0.5;
r_refdef.viewangles[YAW] -= lcd_yaw.value;
for (i=0 ; i<3 ; i++)
r_refdef.vieworg[i] -= right[i]*lcd_x.value;
R_RenderView ();
vid.buffer += vid.rowbytes>>1;
R_PushDlights ();
r_refdef.viewangles[YAW] += lcd_yaw.value*2;
for (i=0 ; i<3 ; i++)
r_refdef.vieworg[i] += 2*right[i]*lcd_x.value;
R_RenderView ();
vid.buffer -= vid.rowbytes>>1;
r_refdef.vrect.height <<= 1;
@ -1708,7 +1706,9 @@ void V_RenderView (void)
{
R_RenderView ();
}
//Blub's debug tracemove: to use: uncomment this, go above and uncomment the functions used above this one, and go in qc and make the player spawn an entity of .enemy
//tryLine();
}
//============================================================================
@ -1720,7 +1720,7 @@ V_Init
*/
void V_Init (void)
{
Cmd_AddCommand ("v_cshift", V_cshift_f);
Cmd_AddCommand ("v_cshift", V_cshift_f);
Cmd_AddCommand ("bf", V_BonusFlash_f);
Cmd_AddCommand ("centerview", V_StartPitchDrift);
@ -1739,7 +1739,6 @@ void V_Init (void)
Cvar_RegisterVariable (&v_idlescale);
Cvar_RegisterVariable (&crosshair);
Cvar_RegisterVariable (&gl_cshiftpercent);
Cvar_RegisterVariable (&scr_ofsx);
Cvar_RegisterVariable (&scr_ofsy);
@ -1750,12 +1749,17 @@ void V_Init (void)
Cvar_RegisterVariable (&cl_bobcycle);
Cvar_RegisterVariable (&cl_bobup);
Cvar_RegisterVariable (&cl_sidebobbing);
Cvar_RegisterVariable (&cl_bobside);
Cvar_RegisterVariable (&cl_bobsidecycle);
Cvar_RegisterVariable (&cl_bobsideup);
Cvar_RegisterVariable (&v_kicktime);
Cvar_RegisterVariable (&v_kickroll);
Cvar_RegisterVariable (&v_kickpitch);
Cvar_RegisterVariable (&v_kickpitch);
BuildGammaTable (1.0); // no gamma yet
Cvar_RegisterVariable (&v_gamma);
BuildGammaTable (v_gamma.value); // no gamma yet
}

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@ -26,8 +26,10 @@ extern byte ramps[3][256];
extern float v_blend[4];
extern cvar_t lcd_x;
extern vec3_t CWeaponRot;
extern vec3_t CWeaponOffset;//blubs declared this
extern vec3_t CWeaponRot;
void V_Init (void);
void V_RenderView (void);