Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start unification of QuakeGX #33

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/cdaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

int CDAudio_Init(void);
#ifndef __WII__
void CDAudio_Play(byte track, qboolean looping);
#else
void CDAudio_Play(char* filename, qboolean looping)
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
#endif
#ifdef __PSP__
void CDAudio_PlayFromString(char* track_name, qboolean looping);
#endif // __PSP__
Expand Down
100 changes: 87 additions & 13 deletions source/cl_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ state bit 2 is edge triggered on the down to up transition
===============================================================================
*/


#ifdef __WII__
kbutton_t in_vlock;
extern float scr_usetime_off;
#endif
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;
Expand Down Expand Up @@ -119,14 +122,16 @@ qboolean croshhairmoving = false;

void IN_KLookDown (void) {KeyDown(&in_klook);}
void IN_KLookUp (void) {KeyUp(&in_klook);}

#ifdef __WII__
void IN_VLockDown (void) {KeyDown(&in_vlock);}
void IN_VLockUp (void) {KeyUp(&in_vlock);}
#endif
/*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);}
Expand Down Expand Up @@ -160,8 +165,33 @@ void IN_StrafeUp(void) {KeyUp(&in_strafe);}
void IN_AttackDown(void) {KeyDown(&in_attack);}
void IN_AttackUp(void) {KeyUp(&in_attack);}

void IN_UseDown (void) {KeyDown(&in_use);}
void IN_UseUp (void) {KeyUp(&in_use);}
void IN_UseDown (void) {
KeyDown(&in_use);
#ifdef __WII__
//
// sB this is all hacked in for now.
// the real concern is that there are now
// 3 binds all hardcoded to '+ use'
// this is not ideal for a number of reasons :/
//
if (scr_usetime_off <= 0) {
KeyDown(&in_vlock);
}
// if moving HACK
if (croshhairmoving == 1) {
if (cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2) {
KeyUp(&in_vlock);
Cbuf_AddText("impulse 23\n"); // sprinting impulse - "impulse 23"
}
}
#endif
}
void IN_UseUp (void) {
KeyUp(&in_use);
#ifdef __WII__
KeyUp(&in_vlock);
#endif
}
void IN_JumpDown (void) {KeyDown(&in_jump);}
void IN_JumpUp (void) {KeyUp(&in_jump);}
void IN_GrenadeDown (void) {KeyDown(&in_grenade);}
Expand Down Expand Up @@ -251,6 +281,10 @@ 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};

#ifdef __WII__
cvar_t ads_center = {"ads_center", "0", true};
cvar_t sniper_center = {"sniper_center", "0", true};
#endif

//Shpuld - Porting over lower sens for lower fov
extern cvar_t scr_fov;
Expand Down Expand Up @@ -298,10 +332,13 @@ void CL_AdjustAngles (void)
#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
#elif _3DS
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__
#else
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left);
#endif
cl.viewangles[YAW] = anglemod(cl.viewangles[YAW]);
}
if (in_klook.state & 1)
Expand All @@ -314,9 +351,12 @@ void CL_AdjustAngles (void)
#ifdef __PSP__
up = CL_KeyState (&in_lookup) * in_sensitivity.value;
down = CL_KeyState(&in_lookdown) * in_sensitivity.value;
#else
#elif _3DS
up = CL_KeyState (&in_lookup) * sensitivity.value;
down = CL_KeyState(&in_lookdown) * sensitivity.value;
#else
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
up = CL_KeyState (&in_lookup);
down = CL_KeyState(&in_lookdown);
#endif // __PSP__

cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
Expand Down Expand Up @@ -454,6 +494,9 @@ int EN_Find(int num,char *string)
return 0;
}

#ifdef __WII__
qboolean aimsnap = false;
#endif
void CL_Aim_Snap(void)
{
edict_t *z,*bz,*player;
Expand Down Expand Up @@ -524,8 +567,13 @@ void CL_Aim_Snap(void)

if(distVec[0] < -70 || distVec[0] > 80)
return;

#ifdef __WII__
aimsnap = true;
#endif
VectorCopy(distVec,cl.viewangles);
#ifdef __WII__
aimsnap = false;
#endif
}
}

Expand All @@ -538,9 +586,11 @@ CL_SendMove
int zoom_snap;
float angledelta(float a);
float deltaPitch,deltaYaw;
#ifdef __WII__
extern cvar_t cl_crossx, cl_crossy;
#endif
void CL_SendMove (usercmd_t *cmd)
{
int i;
long int bits;
sizebuf_t buf;
byte data[128];
Expand All @@ -561,8 +611,12 @@ void CL_SendMove (usercmd_t *cmd)
zoom_snap = 1;
}
}
else
else {
zoom_snap = 0;
#ifdef __WII__
aimsnap = false;
#endif
}

//==== Sniper Scope Swaying ====
if(cl.stats[STAT_ZOOM] == 2 && !(cl.perks & 64))
Expand Down Expand Up @@ -599,8 +653,26 @@ void CL_SendMove (usercmd_t *cmd)
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times

VectorAdd(cl.gun_kick, cl.viewangles, tempv);
#ifdef __WII__
float xcrossnormal, ycrossnormal;
xcrossnormal = (cl_crossx.value / (vid.width/2)) * IR_YAWRANGE;
ycrossnormal = (cl_crossy.value / (vid.height/2)) * IR_PITCHRANGE;

// sB lock crosshair in the center of screen
if(aimsnap == true || (cl.stats[STAT_ZOOM] == 1 && ads_center.value) || sniper_center.value) {
MSG_WriteFloat (&buf, tempv[PITCH]/* + (cl_crossy.value/vid.height) * IR_PITCHRANGE*/);
MSG_WriteFloat (&buf, tempv[YAW]/* - (cl_crossx.value/vid.width - 1) * IR_YAWRANGE*/);
MSG_WriteFloat (&buf, tempv[ROLL]);
} else {
//sBTODO figure out how to make this way more accurate than it is
MSG_WriteFloat (&buf, tempv[PITCH] + ycrossnormal);
MSG_WriteFloat (&buf, tempv[YAW] - xcrossnormal);
MSG_WriteFloat (&buf, tempv[ROLL]);
}
#else
for (i=0 ; i<3 ; i++)
MSG_WriteFloat (&buf, tempv[i]);
#endif

MSG_WriteShort (&buf, cmd->forwardmove);
MSG_WriteShort (&buf, cmd->sidemove);
Expand Down Expand Up @@ -718,8 +790,10 @@ void CL_InitInput (void)
Cmd_AddCommand ("impulse", IN_Impulse);
Cmd_AddCommand ("+klook", IN_KLookDown);
Cmd_AddCommand ("-klook", IN_KLookUp);


#ifdef __WII__
Cmd_AddCommand ("+vlock", IN_VLockDown);
Cmd_AddCommand ("-vlock", IN_VLockUp);
#endif

}

29 changes: 22 additions & 7 deletions source/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ cvar_t lookspring = {"lookspring","0", true};
cvar_t lookstrafe = {"lookstrafe","0", true};
#ifdef __PSP__
cvar_t in_sensitivity = {"sensitivity","3", true};
#else
#elif _3DS
cvar_t sensitivity = {"sensitivity","8", true};
#else
cvar_t sensitivity = {"sensitivity","3", true};
#endif // __PSP__
cvar_t in_tolerance = {"tolerance","0.25", true};
cvar_t in_acceleration = {"acceleration","1.0", true};
Expand Down Expand Up @@ -750,13 +752,13 @@ void CL_RelinkEntities (void)

AngleVectors (tempangles, v_forward, v_right, v_up);
VectorCopy (cl_entities[cl.viewentity].origin, smokeorg);
smokeorg[2] += 32;
smokeorg[2] += cl.viewheight; // account for beta maps
VectorCopy(smokeorg,start);

right_offset = sv_player->v.Flash_Offset[0];
up_offset = sv_player->v.Flash_Offset[1];
forward_offset = sv_player->v.Flash_Offset[2];

right_offset = right_offset/1000;
up_offset = up_offset/1000;
forward_offset = forward_offset/1000;
Expand All @@ -765,7 +767,6 @@ 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);
}

Expand Down Expand Up @@ -872,28 +873,38 @@ void CL_RelinkEntities (void)

if (ent->effects & EF_RAYGREEN)
{
#ifdef __WII__
QMB_RocketTrail(oldorg, ent->origin, RAYGREEN_TRAIL);
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
#else
R_RocketTrail (oldorg, ent->origin, 12);
#endif
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 25;
dl->die = cl.time + 0.01;
dl->color[0] = 0;
dl->color[1] = 255;
dl->color[2] = 0;
dl->type = SetDlightColor (2, lt_rocket, true);
//DLight color 4 is green
dl->type = SetDlightColor (4, lt_rocket, true);
}

if (ent->effects & EF_RAYRED)
{
#ifdef __WII__
QMB_RocketTrail(oldorg, ent->origin, RAYRED_TRAIL);
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
#else
R_RocketTrail (oldorg, ent->origin, 13);
#endif
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 25;
dl->die = cl.time + 0.01;
dl->color[0] = 255;
dl->color[1] = 0;
dl->color[2] = 0;
dl->type = SetDlightColor (2, lt_rocket, true);
//DLight color 1 is red
dl->type = SetDlightColor (1, lt_rocket, true);
}

if (!strcmp(ent->model->name, "progs/flame2.mdl"))
Expand Down Expand Up @@ -1116,7 +1127,11 @@ void CL_Init (void)
Cvar_RegisterVariable (&in_analog_strafe);
Cvar_RegisterVariable (&in_x_axis_adjust);
Cvar_RegisterVariable (&in_y_axis_adjust);


#ifdef __WII__
Cvar_RegisterVariable (&ads_center);
Cvar_RegisterVariable (&sniper_center);
#endif

Cvar_RegisterVariable (&m_pitch);
Cvar_RegisterVariable (&m_yaw);
Expand Down
6 changes: 5 additions & 1 deletion source/cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int has_perk_deadshot;
int has_perk_mulekick;
void CL_ParseServerInfo (void)
{
char *str, tempname[MAX_QPATH];;
char *str;
int i;
int nummodels, numsounds;
char model_precache[MAX_MODELS][MAX_QPATH];
Expand Down Expand Up @@ -1214,9 +1214,13 @@ void CL_ParseServerMessage (void)

case svc_rumble:
// This platform doesn't use this.
#ifdef __WII__
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
Wiimote_Rumble ((int)MSG_ReadShort(), (int)MSG_ReadShort(), (int)MSG_ReadShort());
#else
MSG_ReadShort();
MSG_ReadShort();
MSG_ReadShort();
#endif
break;

case svc_screenflash:
Expand Down
6 changes: 6 additions & 0 deletions source/cl_slist.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ void SList_Switch (int a, int b)
if (b >= MAX_SERVER_LIST || b < 0)
Sys_Error ("SList_Switch: Bad index %d", b);

#ifdef __PSP__
memcpy_vfpu(&temp, &slist[a], sizeof(temp));
memcpy_vfpu(&slist[a], &slist[b], sizeof(temp));
memcpy_vfpu(&slist[b], &temp, sizeof(temp));
#else
memcpy(&temp, &slist[a], sizeof(temp));
memcpy(&slist[a], &slist[b], sizeof(temp));
memcpy(&slist[b], &temp, sizeof(temp));
#endif
}

int SList_Length (void)
Expand Down
5 changes: 2 additions & 3 deletions source/cl_tent.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,11 @@ void CL_UpdateTEnts (void)
if (!b->model || b->endtime < cl.time)
continue;

#ifdef __PSP__
// if coming from the player, update the start position
if (b->entity == cl.viewentity)
{
VectorCopy (cl_entities[cl.viewentity].origin, b->start);

#ifdef __PSP__
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

Expand Down Expand Up @@ -458,9 +457,9 @@ void CL_UpdateTEnts (void)
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);

Expand Down
3 changes: 3 additions & 0 deletions source/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#include "quakedef.h"
#include "crc.h"
#ifdef __WII__
#include <ctype.h>
tyleryoung88 marked this conversation as resolved.
Show resolved Hide resolved
#endif

// this is a 16 bit, non-reflected CRC using the polynomial 0x1021
// and the initial and final xor values shown below... in other words, the
Expand Down
1 change: 0 additions & 1 deletion source/ctr/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ typedef struct
// cvars
//
extern cvar_t cl_name;
extern cvar_t cl_color;

extern cvar_t cl_upspeed;
extern float cl_forwardspeed;
Expand Down
Loading