Added splitscreen stuff (experimental)

Added a simple reward for losers
Fixed that round-draw would give the teams a reward
Changed cl_movespeedkey to 0.5
Changed prediction quite a lot (jumping glitch fixed)
More changes to the HUD to compensate for multiple screeninstances (splitscreen)
This commit is contained in:
Marco Cawthorne 2017-11-16 16:53:02 -06:00
parent 73ff73851f
commit e18f0dae6d
49 changed files with 767 additions and 467 deletions

View File

@ -59,10 +59,55 @@ vector vHUDColor; // Defined in HUD_Draw (HUD.c)
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)
vector vCrossColor; // Defined in HUD_Draw (HUDCrosshair.c)
float fVGUI_Display; // The VGUI menu currently being drawn
struct
{
//Viewmodel stuff
entity eViewModel;
entity eMuzzleflash;
float fNumBones;
vector vPunchAngle;
float fLastWeapon;
float fBobTime;
float fBob;
//Player fields
entity ePlayer;
vector vPlayerOrigin;
vector vPlayerOriginOld;
vector vPlayerVelocity;
// Camera Fields
//entity ePlayerEnt;
vector vCameraPos;
vector vCameraAngle;
float fCameraTime;
// Flashbang'd
float fFlashTime;
float fFlashAlpha;
//UI fields
float fVGUI_Display; // The VGUI menu currently being drawn
int iShowScores; // This is seperated from the other VGUI stuff so we can check scores while buying and whatnot
//crosshair
int iOldShotMultiplier;
float fCrosshairDistance;
float fDecreaseShotTime;
int iShotMultiplier;
//buy menu
// We can only carry one item per slot, so this is hacking around the last one
int iHUDGrenades;
int iHUDGrenadesSelected;
float fHUDWeaponSelectTime;
float fHUDWeaponSelected;
} seats[4], *pSeat;
float fInputSendNext;
vector vVideoResolution; // Updated every frame
vector vVideoMins; //
vector vVideoResolution; // Updated every frame
// Input globals, feel free to use them since they are updated upon input
float fInputKeyCode;
@ -79,27 +124,14 @@ float fMouseClick;
vector vMousePos;
// Sound Stuff
.string sSoundSample;
.float fVolume;
// Camera Fields
//entity ePlayerEnt;
vector vCameraPos;
vector vCameraAngle;
float fCameraTime;
vector vPlayerOrigin;
vector vPlayerOriginOld;
vector vPlayerVelocity;
vector vPunchAngle;
//.string sSoundSample;
//.float fVolume;
void View_AddPunchAngle( vector vAdd );
void View_PlayAnimation( int iSequence );
string HUD_GetChatColorHEX( float fTeam );
// This actually belongs in Builtins.h since its an undocumented global
vector pmove_vel;
.float weapon;
.float maxframe;
@ -109,10 +141,6 @@ float fWeaponEventPlayer;
.float fWeaponLast;
.float fWeaponBoneID;
// Flashbang'd
var float fFlashTime;
var float fFlashAlpha;
void Animation_ShootWeapon( entity ePlayer );
void Animation_ReloadWeapon( entity ePlayer );

View File

@ -64,7 +64,7 @@ Just prints whatever is in the chat buffer and removes lines after some time.
=================
*/
void CSQC_DrawChat( void ) {
vector vChatPos = [ 16, vVideoResolution_y - 128 ];
vector vChatPos = vVideoMins + [ 16, vVideoResolution_y - 128 ];
// Remove messages after a fChatTime has passed
if ( fChatTime < time ) {
@ -111,9 +111,10 @@ void CSQC_DrawCenterprint( void ) {
}
}
vCenterPrintPos_y = ( vVideoResolution_y / 2 ) - ( fCenterPrintLines - 4 );
vCenterPrintPos_y = vVideoMins_y + ( vVideoResolution_y / 2 ) - ( fCenterPrintLines - 4 );
for ( int i = 0; i < ( fCenterPrintLines ); i++ ) {
vCenterPrintPos_x = ( vVideoResolution_x / 2 ) - ( stringwidth( sCenterPrintBuffer[ i ], FALSE ) / 2 );
vCenterPrintPos_x = vVideoMins_x + ( vVideoResolution_x / 2 ) - ( stringwidth( sCenterPrintBuffer[ i ], FALSE ) / 2 );
drawstring( vCenterPrintPos + '1 1', sCenterPrintBuffer[ i ], '8 8', '0 0 0', fCenterPrintAlpha, 0 );
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8', '1 1 1', fCenterPrintAlpha, 0 );
vCenterPrintPos_y += 8;
@ -150,6 +151,8 @@ Entry point for drawing on the client
=================
*/
void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
float needcursor;
int s;
vVideoResolution_x = fWinWidth;
vVideoResolution_y = fWinHeight;
@ -157,48 +160,108 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
setproperty( VF_DRAWENGINESBAR, 0 );
setproperty( VF_DRAWCROSSHAIR, 0 );
//just in case...
if ( numclientseats > seats.length ) {
numclientseats = seats.length;
}
for ( s = seats.length; s-- > numclientseats; ) {
pSeat = &seats[ s ];
pSeat->fVGUI_Display = VGUI_MOTD;
pSeat->ePlayer = world;
}
for ( s = numclientseats; s-- > 0; ) {
pSeat = &seats[ s ];
setproperty( VF_ACTIVESEAT, (float)s );
pSeat->ePlayer = self = findfloat( world, entnum, player_localentnum );
if ( self ) {
Player_Predict();
}
}
addentities( MASK_ENGINE );
Nightvision_PreDraw();
setproperty( VF_AFOV, cvar( "fov" ) * ( getstatf( STAT_VIEWZOOM ) / 255 ) );
setsensitivityscaler( ( getstatf( STAT_VIEWZOOM ) / 255 ) );
// When Cameratime is active, draw on the forced coords instead
if ( fCameraTime > time ) {
setproperty( VF_ORIGIN, vCameraPos) ;
setproperty( VF_ANGLES, vCameraAngle );
} else {
setproperty( VF_ORIGIN, vPlayerOrigin + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ] );
setproperty( VF_ANGLES, view_angles );
View_DrawViewModel();
}
setproperty( VF_ANGLES, view_angles + vPunchAngle );
renderscene();
View_DropPunchAngle();
Nightvision_PostDraw();
if( fGameFocus == TRUE ) {
// The spectator sees things... differently
if ( getplayerkeyvalue( player_localnum, "*spec" ) != "0" ) {
VGUI_DrawSpectatorHUD();
for ( s = 0; s < numclientseats; s++ ) {
pSeat = &seats[ s ];
setproperty( VF_ACTIVESEAT, (float)s );
if ( autocvar_cl_thirdperson == TRUE && getstatf( STAT_HEALTH ) ) {
setproperty( VF_VIEWENTITY, (float)0 );
} else {
HUD_Draw();
setproperty( VF_VIEWENTITY, (float)player_localentnum );
}
HUD_DrawOrbituaries();
CSQC_DrawChat();
// Don't even try to draw centerprints and VGUI menus when scores are shown
if ( iShowScores == TRUE ) {
VGUI_Scores_Show();
} else {
CSQC_DrawCenterprint();
CSQC_VGUI_Draw();
setproperty( VF_AFOV, cvar( "fov" ) * ( getstatf( STAT_VIEWZOOM ) / 255 ) );
setsensitivityscaler( ( getstatf( STAT_VIEWZOOM ) / 255 ) );
// When Cameratime is active, draw on the forced coords instead
if ( pSeat->fCameraTime > time ) {
setproperty( VF_ORIGIN, pSeat->vCameraPos ) ;
} else {
setproperty( VF_ORIGIN, pSeat->vPlayerOrigin + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ] );
View_DrawViewModel();
}
//FIXME: this is awkward. renderscene internally rounds to pixels.
//on the other hand, drawpic uses linear filtering and multisample and stuff.
//this means that there can be a pixel or so difference between scene and 2d.
//as a general rule, you won't notice unless there's some big drawfills.
switch ( numclientseats ) {
case 3:
if (!s)
{
case 2:
vVideoResolution = [ fWinWidth, fWinHeight * 0.5 ];
vVideoMins = [ 0, ( s & 1 ) * vVideoResolution_y ];
break;
}
s++;
case 4:
vVideoResolution = [ fWinWidth, fWinHeight ] * 0.5;
vVideoMins = [ (s&1) * vVideoResolution_x, ( s / 2i ) * vVideoResolution_y ];
break;
default:
vVideoResolution = [ fWinWidth, fWinHeight ];
vVideoMins = [ 0, 0 ];
break;
}
setproperty( VF_MIN, vVideoMins );
setproperty( VF_SIZE, vVideoResolution );
setproperty( VF_ANGLES, view_angles + pSeat->vPunchAngle );
renderscene();
View_DropPunchAngle();
Nightvision_PostDraw();
if( fGameFocus == TRUE ) {
// The spectator sees things... differently
if ( getplayerkeyvalue( player_localnum, "*spec" ) != "0" ) {
VGUI_DrawSpectatorHUD();
} else {
HUD_Draw();
}
HUD_DrawOrbituaries();
CSQC_DrawChat();
// Don't even try to draw centerprints and VGUI menus when scores are shown
if ( pSeat->iShowScores == TRUE ) {
VGUI_Scores_Show();
} else {
CSQC_DrawCenterprint();
needcursor |= CSQC_VGUI_Draw();
}
}
}
pSeat = (void*)0x70000000i;
if ( needcursor ) {
setcursormode( TRUE, "gfx/cursor", '0 0 0', 1.0f );
} else {
setcursormode( FALSE, "gfx/cursor", '0 0 0', 1.0f );
}
Sound_ProcessWordQue();
@ -212,5 +275,5 @@ Doesn't really do anything useful yet
=================
*/
void CSQC_UpdateViewLoading( float fWinWidth, float fWinHeight, float fGameFocus ) {
drawfill( [ 0, 0 ], [ fWinWidth, fWinHeight ], [ 1, 1, 1 ], 1, 0 );
}

View File

@ -39,7 +39,10 @@ void CSQC_Ent_Update( float flIsNew ) {
self.solid = SOLID_SLIDEBOX;
self.predraw = Player_PreDraw;
self.drawmask = MASK_ENGINE;
self.pmove_frame = servercommandframe;
}
else
Player_PreUpdate();
self.modelindex = readbyte();
self.origin_x = readcoord();
@ -54,6 +57,8 @@ void CSQC_Ent_Update( float flIsNew ) {
self.flags = readfloat();
self.weapon = readbyte();
Player_PostUpdate();
if ( self.flags & FL_CROUCHING ) {
setsize( self, VEC_CHULL_MIN, VEC_CHULL_MAX );
} else {

View File

@ -114,6 +114,9 @@ Can interject cmds and create new ones
=================
*/
float CSQC_ConsoleCommand( string sCMD ) {
int s = (float)getproperty( VF_ACTIVESEAT ); //the engine will hide the p1 etc commands... which is fun...
pSeat = &seats[ s ];
tokenize( sCMD );
switch ( argv(0) ) {
case "vox_test":
@ -154,12 +157,12 @@ float CSQC_ConsoleCommand( string sCMD ) {
break;
case "buy":
if( getstatf( STAT_BUYZONE ) == TRUE ) {
fVGUI_Display = VGUI_BM_MAIN;
pSeat->fVGUI_Display = VGUI_BM_MAIN;
}
return TRUE;
break;
case "chooseteam":
fVGUI_Display = VGUI_TEAMSELECT;
case "chooseteam":
pSeat->fVGUI_Display = VGUI_TEAMSELECT;
return TRUE;
break;
case "invnext":
@ -171,11 +174,11 @@ float CSQC_ConsoleCommand( string sCMD ) {
return TRUE;
break;
case "+showscores":
iShowScores = TRUE;
pSeat->iShowScores = TRUE;
return TRUE;
break;
case "-showscores":
iShowScores = FALSE;
pSeat->iShowScores = FALSE;
return TRUE;
break;
case "nightvision":
@ -418,19 +421,46 @@ Whenever we call a SVC_CGAMEPACKET on the SSQC, this is being run
=================
*/
void CSQC_Parse_Event( void ) {
int s = (float)getproperty( VF_ACTIVESEAT ); //always 0, unless it was sent with a MULTICAST_ONE or MULTICAST_ONE_R to p2+
pSeat = &seats[ s ];
float fHeader = readbyte();
if ( fHeader == EV_WEAPON_DRAW ) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
setproperty(VF_ACTIVESEAT, (float)s);
pSeat = &seats[s];
break;
}
Weapon_Draw( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_PRIMARYATTACK ) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
setproperty(VF_ACTIVESEAT, (float)s);
pSeat = &seats[s];
break;
}
Weapon_PrimaryAttack( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_SECONDARYATTACK ) {
Weapon_SecondaryAttack( getstatf( STAT_ACTIVEWEAPON ) );
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
setproperty(VF_ACTIVESEAT, (float)s);
pSeat = &seats[s];
break;
}
Weapon_SecondaryAttack( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_WEAPON_RELOAD ) {
fWeaponEventPlayer = readbyte();
for (s = 0; s < numclientseats; s++) //lame loop
if (seats[s].ePlayer.entnum == fWeaponEventPlayer) {
setproperty(VF_ACTIVESEAT, (float)s);
pSeat = &seats[s];
break;
}
Weapon_Reload( getstatf( STAT_ACTIVEWEAPON ) );
} else if ( fHeader == EV_MODELGIB ) {
vector vPos;
@ -446,15 +476,15 @@ void CSQC_Parse_Event( void ) {
float fStyle = readbyte();
Effect_BreakModel( vPos, vSize, '0 0 0', fStyle );
} else if ( fHeader == EV_CAMERATRIGGER ) {
vCameraPos_x = readcoord();
vCameraPos_y = readcoord();
vCameraPos_z = readcoord();
pSeat->vCameraPos.x = readcoord();
pSeat->vCameraPos.y = readcoord();
pSeat->vCameraPos.z = readcoord();
vCameraAngle_x = readcoord();
vCameraAngle_y = readcoord();
vCameraAngle_z = readcoord();
pSeat->vCameraAngle.x = readcoord();
pSeat->vCameraAngle.y = readcoord();
pSeat->vCameraAngle.z = readcoord();
fCameraTime = time + readfloat();
pSeat->fCameraTime = time + readfloat();
} else if ( fHeader == EV_RADIOMSG ) {
Radio_PlayMessage( readbyte() );
} else if ( fHeader == EV_RADIOMSG2 ) {
@ -504,8 +534,8 @@ void CSQC_Parse_Event( void ) {
Effect_CreateSmoke( vSmokePos );
} else if ( fHeader == EV_FLASH ) {
fFlashTime = 3.0f;
fFlashAlpha = 1.0f;
pSeat->fFlashTime = 3.0f;
pSeat->fFlashAlpha = 1.0f;
} else if ( fHeader == EV_CHAT ) {
float fSender = readbyte();
float fTeam = readbyte();
@ -580,10 +610,13 @@ Hijacks and controls what input globals are being sent to the server
=================
*/
void CSQC_Input_Frame( void ) {
int s = (float)getproperty( VF_ACTIVESEAT );
pSeat = &seats[ s ];
// If we are inside a VGUI, don't let the client do stuff outside
if ( ( fVGUI_Display != VGUI_NONE ) ) {
if ( ( pSeat->fVGUI_Display != VGUI_NONE ) ) {
fInputSendNext = time + 0.2;
} else if ( ( fHUDWeaponSelected ) && ( input_buttons & INPUT_BUTTON0 ) ) {
} else if ( ( pSeat->fHUDWeaponSelected ) && ( input_buttons & INPUT_BUTTON0 ) ) {
HUD_DrawWeaponSelect_Trigger();
input_buttons = 0;
fInputSendNext = time + 0.2;
@ -611,5 +644,5 @@ void CSQC_Input_Frame( void ) {
input_buttons |= INPUT_BUTTON6;
}
input_angles += vPunchAngle;
input_angles += pSeat->vPunchAngle;
}

View File

@ -111,7 +111,7 @@ void HUD_DrawHealth( void ) {
fHealthAlpha = HUD_ALPHA;
}
vector vHealthPos = [ 16, vVideoResolution_y - 42 ];
vector vHealthPos = vVideoMins + [ 16, vVideoResolution_y - 42 ];
drawsubpic( vHealthPos, '24 24 0', HUD_NUMFILE_LAYER, [ NUMSIZE_X * 2, NUMSIZE_Y], [ NUMSIZE_X, NUMSIZE_X ], vHUDColor, HUD_ALPHA, DRAWFLAG_ADDITIVE );
HUD_DrawNums( getstatf( STAT_HEALTH ), vHealthPos + '72 0', HUD_ALPHA, vHUDColor );
fOldHealth = getstatf( STAT_HEALTH );
@ -137,7 +137,7 @@ void HUD_DrawArmor( void ) {
fArmorAlpha = HUD_ALPHA;
}
vector vArmorPos = [ 128, vVideoResolution_y - 42 ];
vector vArmorPos = vVideoMins + [ 128, vVideoResolution_y - 42 ];
drawsubpic( vArmorPos, '24 24 0', HUD_NUMFILE_LAYER, [ 0, NUMSIZE_Y], [ NUMSIZE_X, NUMSIZE_X ], vHUDColor, fArmorAlpha, DRAWFLAG_ADDITIVE );
HUD_DrawNums( getstatf( STAT_ARMOR ), vArmorPos + '72 0', fArmorAlpha, vHUDColor);
fOldArmor = getstatf( STAT_ARMOR );
@ -153,19 +153,19 @@ Draw icons such as hostage, bomb and buyzones
void HUD_DrawIcons( void ) {
// BuyZone Icon
if( getstatf( STAT_BUYZONE ) == TRUE ) {
vector vBuyIconPos = [ 16, ( vVideoResolution_y / 2 ) - 12 ];
vector vBuyIconPos = vVideoMins + [ 16, ( vVideoResolution_y / 2 ) - 12 ];
drawsubpic( vBuyIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0.125 * 3, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1, DRAWFLAG_ADDITIVE );
}
// Hostage-Rescue Area Icon
if( getstatf( STAT_HOSTAGEZONE ) == TRUE ) {
vector vRIconPos = [ 16, ( vVideoResolution_y / 2 ) + 24 ];
vector vRIconPos = vVideoMins + [ 16, ( vVideoResolution_y / 2 ) + 24 ];
drawsubpic( vRIconPos, '32 32 0', HUD_NUMFILE_LAYER, [ 0.125 * 2, 0.125 * 5 - 0.046875], [ 0.125, 0.125 ], '0 1 0', 1, DRAWFLAG_ADDITIVE );
}
// Bomb-Area
if( getstatf( STAT_BOMBZONE ) == TRUE ) {
vector vBIconPos = [ 16, ( vVideoResolution_y / 2 ) + 24 ];
vector vBIconPos = vVideoMins + [ 16, ( vVideoResolution_y / 2 ) + 24 ];
if ( getstatf( STAT_ACTIVEWEAPON ) == WEAPON_C4BOMB ) {
float fAlpha = fabs( sin( time * 20 ) );
@ -188,8 +188,8 @@ void HUD_DrawTimer( void ) {
static int iOldUnits;
static float fTimerAlpha;
int iMinutes, iSeconds, iTens, iUnits;
vector vTimePos = [ ( vVideoResolution_x / 2 ) - 62, vVideoResolution_y - 42 ];
vector vTimePos = vVideoMins+[ ( vVideoResolution_x / 2 ) - 62, vVideoResolution_y - 42 ];
if( serverkey( "timelimit" ) ) {
float fTimeLeft = ( stof( serverkey( "timelimit" ) ) * 60 ) - getstatf( STAT_GAMETIME );
if ( fTimeLeft < 0 ) {
@ -292,7 +292,7 @@ void HUD_DrawMoney( void ) {
fMoneyDifference = fOldMoneyValue - getstatf( STAT_MONEY );
}
vector vMoneyPos = [ vVideoResolution_x - 160, vVideoResolution_y - 72 ];
vector vMoneyPos = vVideoMins+[ vVideoResolution_x - 160, vVideoResolution_y - 72 ];
// If the alpha/color effect is active, draw the money twice in their varying alphas/colors
if ( fMoneyAlphaEffect > 0 ) {
@ -353,20 +353,20 @@ void HUD_DrawAmmo( void ) {
}
if ( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber < 11 ) {
vAmmoMagPos = [ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
vAmmoMagPos = vVideoMins+[ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, vHUDColor );
drawsubpic( [vVideoResolution_x - 118, vVideoResolution_y - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [ 0.01171875, 0.09765625 ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
drawsubpic( vVideoMins+[vVideoResolution_x - 118, vVideoResolution_y - 42], '3 25', HUD_NUMFILE_LAYER, [0.9375, 0], [ 0.01171875, 0.09765625 ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
vAmmoCalPos = [ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
vAmmoCalPos = vVideoMins+[ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_CALIBER ), vAmmoCalPos, fAmmoAlpha, vHUDColor );
} else {
vAmmoMagPos = [ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
vAmmoMagPos = vVideoMins+[ vVideoResolution_x - 64, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, vHUDColor );
}
// Caliber icon
drawsubpic( vVideoResolution - '42 42', '24 24', HUD_NUMFILE_LAYER, vHUDCalPos[ wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber ], [ NUMSIZE_X, NUMSIZE_X ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
drawsubpic( vVideoMins+vVideoResolution - '42 42', '24 24', HUD_NUMFILE_LAYER, vHUDCalPos[ wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber ], [ NUMSIZE_X, NUMSIZE_X ], vHUDColor, fAmmoAlpha, DRAWFLAG_ADDITIVE );
fOldMag = getstatf( STAT_CURRENT_MAG );
fOldCal = getstatf( STAT_CURRENT_CALIBER );
}
@ -376,8 +376,9 @@ void HUD_DrawProgressBar( void ) {
vector vMainPos;
if ( getstatf( STAT_PROGRESS ) > 0 ) {
vMainPos_x = ( vVideoResolution_x / 2 ) - (vSize_x / 2);
vMainPos_y = ( vVideoResolution_y / 2 ) - (vSize_y / 2);
vMainPos = vVideoMins;
vMainPos_x += ( vVideoResolution_x / 2 ) - (vSize_x / 2);
vMainPos_y += ( vVideoResolution_y / 2 ) - (vSize_y / 2);
// Draw the background
vector vBar = vSize;
@ -395,21 +396,21 @@ void HUD_DrawProgressBar( void ) {
void HUD_DrawRadar( void ) {
drawpic( '16 16', "sprites/radar640.spr_0.tga", '128 128', '1 1 1', 0.5, DRAWFLAG_ADDITIVE );
drawpic( vVideoMins + '16 16', "sprites/radar640.spr_0.tga", '128 128', '1 1 1', 0.5, DRAWFLAG_ADDITIVE );
}
void HUD_DrawFlash( void ) {
if ( fFlashTime > 0.0f ) {
fFlashTime -= frametime;
if ( pSeat->fFlashTime > 0.0f ) {
pSeat->fFlashTime -= frametime;
} else {
if ( fFlashAlpha > 0.0f ) {
fFlashAlpha -= ( frametime * 0.5 );
if ( pSeat->fFlashAlpha > 0.0f ) {
pSeat->fFlashAlpha -= ( frametime * 0.5 );
} else {
return;
}
}
drawfill( '0 0', vVideoResolution, '1 1 1', fFlashAlpha, fFlashTime );
drawfill( vVideoMins, vVideoResolution, '1 1 1', pSeat->fFlashAlpha, 0/*pSeat->fFlashTime*/ );
}
/*

View File

@ -25,11 +25,7 @@ HUD_DrawCrosshair
Draws the cursor every frame, unless spectator
=================
*/
void HUD_DrawCrosshair( void ) {
static int iOldShotMultiplier;
static float fCrosshairDistance;
static float fDecreaseShotTime;
void HUD_DrawCrosshair( void ) {
int iCrosshairDistance;
int iLineLength;
@ -47,48 +43,49 @@ void HUD_DrawCrosshair( void ) {
fDistance = fDistance * 2;
} else if ( getstatf( STAT_FLAGS ) & FL_CROUCHING ) { // Crouching...
fDistance = fDistance * 0.5;
} else if ( vlen( pmove_vel ) > 120 ) { // Running, not walking
} else if ( vlen( pSeat->ePlayer.velocity ) > 120 ) { // Running, not walking
fDistance = fDistance * 1.5;
}
// The amount of shots that we've shot totally does affect our accuracy!
if ( iShotMultiplier > iOldShotMultiplier ) {
fCrosshairDistance = min( 15, fCrosshairDistance + fDeltaDistance );
} else if ( fCrosshairDistance > fDistance ) {
if ( pSeat->iShotMultiplier > pSeat->iOldShotMultiplier ) {
pSeat->fCrosshairDistance = min( 15, pSeat->fCrosshairDistance + fDeltaDistance );
} else if ( pSeat->fCrosshairDistance > fDistance ) {
// Slowly decrease the distance again
fCrosshairDistance -= ( fCrosshairDistance * frametime );
pSeat->fCrosshairDistance -= ( pSeat->fCrosshairDistance * frametime );
if ( ( iShotMultiplier > 0 ) && ( fDecreaseShotTime < time ) ) {
fDecreaseShotTime = time + 0.2;
iShotMultiplier--;
if ( ( pSeat->iShotMultiplier > 0 ) && ( pSeat->fDecreaseShotTime < time ) ) {
pSeat->fDecreaseShotTime = time + 0.2;
pSeat->iShotMultiplier--;
}
}
iOldShotMultiplier = iShotMultiplier;
pSeat->iOldShotMultiplier = pSeat->iShotMultiplier;
if ( fCrosshairDistance < fDistance ) {
fCrosshairDistance = fDistance;
if ( pSeat->fCrosshairDistance < fDistance ) {
pSeat->fCrosshairDistance = fDistance;
}
iCrosshairDistance = ceil( fCrosshairDistance );
iCrosshairDistance = ceil( pSeat->fCrosshairDistance );
iLineLength = ( ( iCrosshairDistance - fDistance ) / 2 ) + 5;
iLineLength = max( 1, iLineLength );
// Line positions
vector vVer1, vVer2, vHor1, vHor2;
vVer1 = vVer2 = vHor1 = vHor2 = vVideoMins;
// Vertical Lines
vVer1_x = ( vVideoResolution_x / 2 );
vVer1_y = ( vVideoResolution_y / 2 ) - ( iCrosshairDistance + iLineLength );
vVer2_x = ( vVideoResolution_x / 2 );
vVer2_y = ( vVideoResolution_y / 2 ) + iCrosshairDistance + 1;
vVer1_x += ( vVideoResolution_x / 2 );
vVer1_y += ( vVideoResolution_y / 2 ) - ( iCrosshairDistance + iLineLength );
vVer2_x += ( vVideoResolution_x / 2 );
vVer2_y += ( vVideoResolution_y / 2 ) + iCrosshairDistance + 1;
// Horizontal Lines
vHor1_x = ( vVideoResolution_x / 2 ) - ( iCrosshairDistance + iLineLength );
vHor1_y = ( vVideoResolution_y / 2 );
vHor2_x = ( vVideoResolution_x / 2 ) + iCrosshairDistance + 1;
vHor2_y = ( vVideoResolution_y / 2 );
vHor1_x += ( vVideoResolution_x / 2 ) - ( iCrosshairDistance + iLineLength );
vHor1_y += ( vVideoResolution_y / 2 );
vHor2_x += ( vVideoResolution_x / 2 ) + iCrosshairDistance + 1;
vHor2_y += ( vVideoResolution_y / 2 );
drawfill( vVer1, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
drawfill( vVer2, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );

View File

@ -84,7 +84,7 @@ This actually displays the contents of orbBuffer
=================
*/
void HUD_DrawOrbituaries( void ) {
vector vOrbPos = [ vVideoResolution_x - 200, 56 ];
vector vOrbPos = vVideoMins + [ vVideoResolution_x - 200, 56 ];
if ( fOrbituaryTime < time && iOrbituaryScroll >= 0 ) {
// We are cheap, just clear the attacker and we're good.
@ -99,7 +99,7 @@ void HUD_DrawOrbituaries( void ) {
}
// Calculate the position based on the saved offsets
vOrbPos_x = vVideoResolution_x - ( orbBuffer[ i ].fOffset1 + orbBuffer[ i ].fOffset2 + orbBuffer[ i ].fOffset3 ) - 16;
vOrbPos_x = vVideoMins_x + vVideoResolution_x - ( orbBuffer[ i ].fOffset1 + orbBuffer[ i ].fOffset2 + orbBuffer[ i ].fOffset3 ) - 16;
// Draw the attacker's name, shadow first
drawstring( vOrbPos + '1 1', orbBuffer[ i ].sAttacker, '8 8', '0 0 0', VGUI_WINDOW_FGALPHA, 0 );

View File

@ -18,10 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// We can only carry one item per slot, so this is hacking around the last one
int iHUDGrenades;
int iHUDGrenadesSelected;
typedef struct {
string sSprite;
vector vOrigin;
@ -65,9 +61,6 @@ vector vHUDSlotNumPos[ 4 ] = {
'0.65625 0.359375 0', // 4 GRENADE
};
float fHUDWeaponSelectTime;
float fHUDWeaponSelected;
/*
=================
HUD_DrawWeaponSelect_NextItem
@ -90,59 +83,59 @@ float HUD_DrawWeaponSelect_NextItem( float fSlot ) {
}
} else if ( fSlot == SLOT_MELEE ) {
// This happens when we go into the slot for the first time
iHUDGrenades = 0;
pSeat->iHUDGrenades = 0;
// Keep this order in order for the selection to work
if ( getstatf( STAT_SLOT_GRENADE ) ) {
iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
pSeat->iHUDGrenades++;
}
if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
pSeat->iHUDGrenades++;
}
if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
iHUDGrenadesSelected = WEAPON_FLASHBANG;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_FLASHBANG;
pSeat->iHUDGrenades++;
}
if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_HEGRENADE;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_HEGRENADE;
pSeat->iHUDGrenades++;
}
// If we have any grenades, proceed with that slot
if ( iHUDGrenades ) {
if ( pSeat->iHUDGrenades ) {
return SLOT_GRENADE;
} else {
return HUD_DrawWeaponSelect_NextItem( SLOT_GRENADE );
}
} else {
// If we're in the grenade slot, go down
if ( iHUDGrenadesSelected == WEAPON_HEGRENADE ) {
if ( pSeat->iHUDGrenadesSelected == WEAPON_HEGRENADE ) {
// Do we have a flash bang? If yes, select that thing
if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
iHUDGrenadesSelected = WEAPON_FLASHBANG;
pSeat->iHUDGrenadesSelected = WEAPON_FLASHBANG;
return SLOT_GRENADE;
} else if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
return SLOT_GRENADE;
} else if ( getstatf( STAT_SLOT_GRENADE ) ) {
iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
pSeat->iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
return SLOT_GRENADE;
}
} else if ( iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
} else if ( pSeat->iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
return SLOT_GRENADE;
} else if ( getstatf( STAT_SLOT_GRENADE ) ) {
iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
pSeat->iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
return SLOT_GRENADE;
}
} else if ( iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
} else if ( pSeat->iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
if ( getstatf( STAT_SLOT_GRENADE ) ) {
iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
pSeat->iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
return SLOT_GRENADE;
}
}
@ -164,27 +157,27 @@ Checks and returns the previous slot with a weapon in it
*/
float HUD_DrawWeaponSelect_PreviousItem( float fSlot ) {
if ( fSlot == SLOT_PRIMARY ) {
iHUDGrenades = 0;
pSeat->iHUDGrenades = 0;
// Keep this order in order for the selection to work
if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_HEGRENADE;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_HEGRENADE;
pSeat->iHUDGrenades++;
}
if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
iHUDGrenadesSelected = WEAPON_FLASHBANG;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_FLASHBANG;
pSeat->iHUDGrenades++;
}
if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
pSeat->iHUDGrenades++;
}
if ( getstatf( STAT_SLOT_GRENADE ) ) {
iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
iHUDGrenades++;
pSeat->iHUDGrenadesSelected = getstatf( STAT_SLOT_GRENADE );
pSeat->iHUDGrenades++;
}
if ( iHUDGrenades ) {
if ( pSeat->iHUDGrenades ) {
return SLOT_GRENADE;
} else {
return HUD_DrawWeaponSelect_PreviousItem( SLOT_GRENADE );
@ -202,29 +195,29 @@ float HUD_DrawWeaponSelect_PreviousItem( float fSlot ) {
return HUD_DrawWeaponSelect_PreviousItem( SLOT_SECONDARY );
}
} else {
if ( iHUDGrenadesSelected == getstatf( STAT_SLOT_GRENADE ) ) {
if ( pSeat->iHUDGrenadesSelected == getstatf( STAT_SLOT_GRENADE ) ) {
if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_SMOKEGRENADE;
return SLOT_GRENADE;
} else if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
iHUDGrenadesSelected = WEAPON_FLASHBANG;
pSeat->iHUDGrenadesSelected = WEAPON_FLASHBANG;
return SLOT_GRENADE;
} else if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_HEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_HEGRENADE;
return SLOT_GRENADE;
}
}
if ( iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
if ( pSeat->iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
iHUDGrenadesSelected = WEAPON_FLASHBANG;
pSeat->iHUDGrenadesSelected = WEAPON_FLASHBANG;
return SLOT_GRENADE;
} else if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_HEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_HEGRENADE;
return SLOT_GRENADE;
}
} else if ( iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
} else if ( pSeat->iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
iHUDGrenadesSelected = WEAPON_HEGRENADE;
pSeat->iHUDGrenadesSelected = WEAPON_HEGRENADE;
return SLOT_GRENADE;
}
}
@ -251,7 +244,7 @@ float HUD_DrawWeaponSelect_GetWeapon( float fSlot ) {
} else if ( fSlot == SLOT_MELEE ) {
return getstatf( STAT_SLOT_MELEE );
} else {
return iHUDGrenadesSelected;
return pSeat->iHUDGrenadesSelected;
}
}
@ -267,15 +260,15 @@ void HUD_DrawWeaponSelect_Forward( void ) {
return;
}
if ( fHUDWeaponSelected == 0 ) {
if ( pSeat->fHUDWeaponSelected == 0 ) {
sound( self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE );
fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_NextItem( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iSlot ) );
pSeat->fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_NextItem( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iSlot ) );
} else {
sound( self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE );
fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_NextItem( wptTable[ fHUDWeaponSelected ].iSlot ) );
pSeat->fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_NextItem( wptTable[ pSeat->fHUDWeaponSelected ].iSlot ) );
}
fHUDWeaponSelectTime = time + 3;
pSeat->fHUDWeaponSelectTime = time + 3;
}
/*
@ -290,15 +283,15 @@ void HUD_DrawWeaponSelect_Back( void ) {
return;
}
if ( fHUDWeaponSelected == 0 ) {
if ( pSeat->fHUDWeaponSelected == 0 ) {
sound( self, CHAN_ITEM, "common/wpn_hudon.wav", 0.5, ATTN_NONE );
fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_PreviousItem( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iSlot ) );
pSeat->fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_PreviousItem( wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iSlot ) );
} else {
sound( self, CHAN_ITEM, "common/wpn_moveselect.wav", 0.5, ATTN_NONE );
fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_PreviousItem( wptTable[ fHUDWeaponSelected ].iSlot ) );
pSeat->fHUDWeaponSelected = HUD_DrawWeaponSelect_GetWeapon( HUD_DrawWeaponSelect_PreviousItem( wptTable[ pSeat->fHUDWeaponSelected ].iSlot ) );
}
fHUDWeaponSelectTime = time + 3;
pSeat->fHUDWeaponSelectTime = time + 3;
}
/*
@ -320,54 +313,54 @@ Drawn every frame through HUD.c
=================
*/
void HUD_DrawWeaponSelect( void ) {
if ( fHUDWeaponSelectTime < time ) {
if ( fHUDWeaponSelected ) {
if ( pSeat->fHUDWeaponSelectTime < time ) {
if ( pSeat->fHUDWeaponSelected ) {
sound( self, CHAN_ITEM, "common/wpn_hudoff.wav", 0.5, ATTN_NONE );
fHUDWeaponSelected = 0;
pSeat->fHUDWeaponSelected = 0;
}
return;
}
vector vSelectPos = '160 12 0';
vector vSelectPos = vVideoMins + '160 12 0';
for ( int i = 0; i < 4; i++ ) {
HUD_DrawWeaponSelect_Num( vSelectPos, i );
// Again, grenades are treated seperately
if ( i == SLOT_GRENADE ) {
if ( wptTable[ fHUDWeaponSelected ].iSlot == SLOT_GRENADE ) {
if ( wptTable[ pSeat->fHUDWeaponSelected ].iSlot == SLOT_GRENADE ) {
if ( getstati_punf( STAT_ITEM_HEGRENADE ) ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ WEAPON_HEGRENADE ].sSprite, wpSymbolTable[ WEAPON_HEGRENADE ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
if ( iHUDGrenadesSelected == WEAPON_HEGRENADE ) {
if ( pSeat->iHUDGrenadesSelected == WEAPON_HEGRENADE ) {
drawsubpic( vSelectPos + '0 20', '170 45', "sprites/640hud3.spr_0.tga", '0 0.703125', [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
}
vSelectPos_y += 45;
}
if ( getstati_punf( STAT_ITEM_FLASHBANG ) ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ WEAPON_FLASHBANG ].sSprite, wpSymbolTable[ WEAPON_FLASHBANG ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
if ( iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
if ( pSeat->iHUDGrenadesSelected == WEAPON_FLASHBANG ) {
drawsubpic( vSelectPos + '0 20', '170 45', "sprites/640hud3.spr_0.tga", '0 0.703125', [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
}
vSelectPos_y += 45;
}
if ( getstati_punf( STAT_ITEM_SMOKEGRENADE ) ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ WEAPON_SMOKEGRENADE ].sSprite, wpSymbolTable[ WEAPON_SMOKEGRENADE ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
if ( iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
if ( pSeat->iHUDGrenadesSelected == WEAPON_SMOKEGRENADE ) {
drawsubpic( vSelectPos + '0 20', '170 45', "sprites/640hud3.spr_0.tga", '0 0.703125', [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
}
vSelectPos_y += 45;
}
if ( getstatf( STAT_SLOT_GRENADE ) ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ getstatf( STAT_SLOT_GRENADE ) ].sSprite, wpSymbolTable[ getstatf( STAT_SLOT_GRENADE ) ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
if ( iHUDGrenadesSelected == getstatf( STAT_SLOT_GRENADE ) ) {
if ( pSeat->iHUDGrenadesSelected == getstatf( STAT_SLOT_GRENADE ) ) {
drawsubpic( vSelectPos + '0 20', '170 45', "sprites/640hud3.spr_0.tga", '0 0.703125', [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
}
vSelectPos_y += 45;
}
}
} else {
if ( wptTable[ fHUDWeaponSelected ].iSlot == i ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ fHUDWeaponSelected ].sSprite, wpSymbolTable[ fHUDWeaponSelected ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
if ( wptTable[ pSeat->fHUDWeaponSelected ].iSlot == i ) {
drawsubpic( vSelectPos + '0 20', '170 45', wpSymbolTable[ pSeat->fHUDWeaponSelected ].sSprite, wpSymbolTable[ pSeat->fHUDWeaponSelected ].vOrigin, [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
drawsubpic( vSelectPos + '0 20', '170 45', "sprites/640hud3.spr_0.tga", '0 0.703125', [ 0.6640625, 0.17578125 ], vHUDColor, 1, DRAWFLAG_ADDITIVE );
vSelectPos_x += 170;
} else {
@ -385,8 +378,8 @@ Called by CSQC_Input_Frame when conditions are met
=================
*/
void HUD_DrawWeaponSelect_Trigger( void ) {
sendevent( "PlayerSwitchWeapon", "f", fHUDWeaponSelected );
sendevent( "PlayerSwitchWeapon", "f", pSeat->fHUDWeaponSelected );
sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.5, ATTN_NONE );
fHUDWeaponSelectTime = 0;
fHUDWeaponSelected = 0;
pSeat->fHUDWeaponSelectTime = 0;
pSeat->fHUDWeaponSelected = 0;
}

View File

@ -26,6 +26,7 @@ Comparable to worldspawn in SSQC in that it's mostly used for precaches
=================
*/
void CSQC_Init(float apilevel, string enginename, float engineversion) {
pSeat = &seats[0];
precache_model( HUD_NUMFILE );
precache_model( "sprites/top_left.spr" );

0
Source/Client/Makefile Normal file → Executable file
View File

View File

@ -18,6 +18,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.float pmove_frame;
.vector netorigin;
.vector netangles;
.vector netvelocity;
.float netpmove_flags;
string sPModels[ CS_WEAPON_COUNT - 1 ] = {
"models/p_knife.mdl",
"models/p_usp.mdl",
@ -48,24 +55,45 @@ string sPModels[ CS_WEAPON_COUNT - 1 ] = {
"models/p_smokegrenade.mdl"
};
//.float bonecontrol1; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol2; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol3; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol4; //Halflife model format bone controller. On player models, this typically affects the spine's yaw.
//.float bonecontrol5; //Halflife model format bone controller. This typically affects the mouth.
//.float subblendfrac; //Weird animation value specific to halflife models. On player models, this typically affects the spine's pitch.
//.float basesubblendfrac; // legs part.
static float Player_Gun_PreDraw (void) {
self.entnum = self.owner.entnum; //so this entity gets its RF_EXTERNALMODEL flag rewritten as needed
addentity(self);
self.entnum = 0; //so that findfloat won't find the wrong thing.
return PREDRAW_NEXT;
}
void Player_Draw( void ) {
if ( !self.eGunModel ) {
self.eGunModel = spawn();
self.eGunModel.classname = "vwep model";
self.eGunModel.owner = self;
self.eGunModel.predraw = Player_Gun_PreDraw;
self.eGunModel.drawmask = MASK_ENGINE;
// Get the weapon bone ID for the current player model
self.fWeaponBoneID = gettagindex( self, "Bip01 R Hand" );
}
// Only bother updating the model if the weapon has changed
if ( self.fWeaponLast != self.weapon ) {
setmodel( self.eGunModel, sPModels[ self.weapon - 1 ] );
if ( self.weapon ) {
setmodel( self.eGunModel, sPModels[ self.weapon - 1 ] );
} else {
setmodel( self.eGunModel, "" );
}
self.fWeaponLast = self.weapon;
// Update the bone index of the current p_ model so we can calculate the offset
// Get the weapon bone ID for the current player model
self.fWeaponBoneID = gettagindex( self, "Bip01 R Hand" );
self.eGunModel.fWeaponBoneID = gettagindex( self.eGunModel, "Bip01 R Hand" );
}
Animation_PlayerUpdate();
self.baseframe1time += frametime;
self.frame1time += frametime;
@ -78,85 +106,111 @@ void Player_Draw( void ) {
=================
Player_PreDraw
Run every before every frame is rendered.
Responsible for local player prediction and other player appearance/interpolation.
Runs as part of the addentities builtin.
Responsible for player appearance/interpolation.
=================
*/
float Player_PreDraw( void ) {
if ( self.entnum == player_localentnum ) {
vector vOldOrigin;
vector vOldVelocity;
float fOldPMoveFlags;
// Don't predict if we're frozen/paused FIXME: FTE doesn't have serverkey_float yet!
if ( serverkey( SERVERKEY_PAUSESTATE ) == "1" || ( ( getstati( STAT_GAMESTATE ) == GAME_FREEZE ) && ( getstati( STAT_HEALTH ) > 0 ) ) ) {
vPlayerOrigin = self.origin;
vOldOrigin = vPlayerOrigin;
self.velocity = '0 0 0';
vOldVelocity = self.velocity;
fOldPMoveFlags = 0;
} else {
vOldOrigin = self.origin;
vOldVelocity = self.velocity;
fOldPMoveFlags = self.pmove_flags;
if ( getplayerkeyvalue( player_localnum, "*spec" ) == "0" ) {
self.movetype = MOVETYPE_WALK;
} else {
self.movetype = MOVETYPE_NOCLIP;
}
for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) {
getinputstate( i );
runstandardplayerphysics( self );
}
}
vPlayerOriginOld = vPlayerOrigin;
if ( ( self.flags & FL_ONGROUND ) && ( self.origin_z - vPlayerOriginOld_z > 0 ) ) {
vPlayerOriginOld_z += frametime * 150;
if ( vPlayerOriginOld_z > self.origin_z ) {
vPlayerOriginOld_z = self.origin_z;
}
if ( self.origin_z - vPlayerOriginOld_z > 18 ) {
vPlayerOriginOld_z = self.origin_z - 18;
}
vPlayerOrigin_z += vPlayerOriginOld_z - self.origin_z;
} else {
vPlayerOriginOld_z = self.origin_z;
}
vPlayerVelocity = self.velocity;
if ( autocvar_cl_thirdperson == TRUE && getstatf( STAT_HEALTH ) > 0 ) {
static vector vStart;
static vector vEnd;
makevectors( view_angles );
vStart = [ self.origin_x, self.origin_y, vPlayerOriginOld_z + 8 ] + ( v_right * 4 );
vEnd = vStart + ( v_forward * -48 ) + '0 0 8' + ( v_right * 4 );
traceline( vStart, vEnd, FALSE, self );
vPlayerOrigin = trace_endpos + ( v_forward * 5 );
self.renderflags = 0;
Player_Draw();
} else {
if ( self.eGunModel ) {
remove( self.eGunModel );
}
self.renderflags = RF_EXTERNALMODEL;
vPlayerOrigin = [ self.origin_x, self.origin_y, vPlayerOriginOld_z ];
}
addentity( self );
self.origin = vOldOrigin;
setorigin( self, self.origin );
self.velocity = vOldVelocity;
self.pmove_flags = fOldPMoveFlags;
self.movetype = MOVETYPE_NONE;
} else {
Player_Draw();
addentity( self );
}
return PREDRAW_NEXT;
Player_Draw();
addentity( self );
return PREDRAW_NEXT;
}
/*
=================
Player_Predict
Runs before every frame is rendered.
Responsible for local player prediction.
=================
*/
void Player_Predict(void) {
vector vOldOrigin = self.origin = self.netorigin;
vector vOldAngles = self.angles = self.netangles;
vector vOldVelocity = self.velocity = self.netvelocity;
float fOldPMoveFlags = self.pmove_flags = self.netpmove_flags;
// Don't predict if we're frozen/paused FIXME: FTE doesn't have serverkey_float yet!
if ( serverkey( SERVERKEY_PAUSESTATE ) == "1" || ( ( getstati( STAT_GAMESTATE ) == GAME_FREEZE ) && ( getstati( STAT_HEALTH ) > 0 ) ) ) {
pSeat->vPlayerOrigin = self.origin;
vOldOrigin = pSeat->vPlayerOrigin;
self.velocity = '0 0 0';
vOldVelocity = self.velocity;
fOldPMoveFlags = 0;
} else {
if ( getplayerkeyvalue( player_localnum, "*spec" ) == "0" ) {
self.movetype = MOVETYPE_WALK;
} else {
self.movetype = MOVETYPE_NOCLIP;
}
for ( int i = self.pmove_frame + 1; i <= clientcommandframe; i++ ) {
getinputstate( i );
runplayerphysics();
}
}
pSeat->vPlayerOriginOld = pSeat->vPlayerOrigin;
if ( ( self.flags & FL_ONGROUND ) && ( self.origin_z - pSeat->vPlayerOriginOld.z > 0 ) ) {
pSeat->vPlayerOriginOld.z += frametime * 150;
if ( pSeat->vPlayerOriginOld.z > self.origin_z ) {
pSeat->vPlayerOriginOld.z = self.origin_z;
}
if ( self.origin_z - pSeat->vPlayerOriginOld.z > 18 ) {
pSeat->vPlayerOriginOld.z = self.origin_z - 18;
}
pSeat->vPlayerOrigin.z += pSeat->vPlayerOriginOld.z - self.origin_z;
} else {
pSeat->vPlayerOriginOld.z = self.origin_z;
}
pSeat->vPlayerVelocity = self.velocity;
if ( autocvar_cl_thirdperson == TRUE && getstatf( STAT_HEALTH ) > 0 ) {
makevectors( view_angles );
vector vStart = [ self.origin_x, self.origin_y, pSeat->vPlayerOriginOld.z + 8 ] + ( v_right * 4 );
vector vEnd = vStart + ( v_forward * -48 ) + '0 0 8' + ( v_right * 4 );
traceline( vStart, vEnd, FALSE, self );
pSeat->vPlayerOrigin = trace_endpos + ( v_forward * 5 );
} else {
pSeat->vPlayerOrigin = [ self.origin_x, self.origin_y, pSeat->vPlayerOriginOld.z ];
}
self.movetype = MOVETYPE_NONE;
}
/*
=================
Player_Preupdate
We're part way through parsing new player data.
Propagate our pmove state to whatever the current frame before its stomped on (so any non-networked state updates locally).
=================
*/
void Player_PreUpdate(void) {
self.origin = self.netorigin;
self.angles = self.netangles;
self.velocity = self.netvelocity;
self.pmove_flags = self.netpmove_flags;
if ( getplayerkeyvalue( player_localnum, "*spec" ) == "0" ) {
self.movetype = MOVETYPE_WALK;
} else {
self.movetype = MOVETYPE_NOCLIP;
}
for ( ; self.pmove_frame < servercommandframe; ) {
if ( getinputstate( ++self.pmove_frame ))
runplayerphysics();
}
self.movetype = MOVETYPE_NONE;
}
void Player_PostUpdate(void) {
self.netorigin = self.origin;
self.netangles = self.angles;
self.netvelocity = self.velocity;
self.netpmove_flags = self.pmove_flags;
self.pmove_frame = servercommandframe;
};

View File

@ -43,29 +43,30 @@ This is the entry point for FreeCS own "VGUI" implementation
Run every frame
=================
*/
void CSQC_VGUI_Draw( void ) {
if ( fVGUI_Display == VGUI_NONE ) {
float CSQC_VGUI_Draw( void ) {
if ( pSeat->fVGUI_Display == VGUI_NONE ) {
setcursormode( FALSE );
return;
return FALSE;
}
vVGUIColor = autocvar_vgui_color * ( 1 / 255 );
if ( fVGUI_Display >= VGUI_RADIO1 ) {
if ( pSeat->fVGUI_Display >= VGUI_RADIO1 ) {
VGUI_Radio_Draw();
return;
return FALSE;
}
setcursormode( TRUE, "gfx/cursor", '0 0 0', 1.0f );
// Align the window to the center
vVGUIWindowPos_x = ( vVideoResolution_x / 2 ) - 320;
vVGUIWindowPos_y = ( vVideoResolution_y / 2 ) - 240;
VGUI_Window( vguiMenus[ fVGUI_Display - 1 ].sTitle, vVGUIWindowPos, '640 480 0' );
vVGUIWindowPos = vVideoMins;
vVGUIWindowPos_x += ( vVideoResolution_x / 2 ) - 320;
vVGUIWindowPos_y += ( vVideoResolution_y / 2 ) - 240;
VGUI_Window( vguiMenus[ pSeat->fVGUI_Display - 1 ].sTitle, vVGUIWindowPos, '640 480 0' );
iVGUIKey = 48;
// Display the contents of whatever we have selected
vguiMenus[ fVGUI_Display - 1 ].vDraw( vVGUIWindowPos );
vguiMenus[ pSeat->fVGUI_Display - 1 ].vDraw( vVGUIWindowPos );
return TRUE;
}
/*
@ -102,5 +103,9 @@ void CSQC_VGUI_Init( void ) {
}
// We start on the MOTD, always
fVGUI_Display = VGUI_MOTD;
for (int s = 0; s < seats.length; s++)
{
pSeat = &seats[s];
pSeat->fVGUI_Display = VGUI_MOTD;
}
}

View File

@ -60,33 +60,33 @@ vguiequipobject_t vguiEquipmentTable[ 7 ] = {
// TODO: Clean this up
void VGUI_BuyMenu_Main( vector vPos ) {
static void BuyMenu_Main_1( void ) {
fVGUI_Display = VGUI_BM_HANDGUNS;
pSeat->fVGUI_Display = VGUI_BM_HANDGUNS;
}
static void BuyMenu_Main_2( void ) {
fVGUI_Display = VGUI_BM_SHOTGUNS;
pSeat->fVGUI_Display = VGUI_BM_SHOTGUNS;
}
static void BuyMenu_Main_3( void ) {
fVGUI_Display = VGUI_BM_SMG;
pSeat->fVGUI_Display = VGUI_BM_SMG;
}
static void BuyMenu_Main_4( void ) {
fVGUI_Display = VGUI_BM_RIFLES;
pSeat->fVGUI_Display = VGUI_BM_RIFLES;
}
static void BuyMenu_Main_5( void ) {
fVGUI_Display = VGUI_BM_MGS;
pSeat->fVGUI_Display = VGUI_BM_MGS;
}
static void BuyMenu_Main_6( void ) {
sendevent( "GamePlayerBuyAmmo", "f", 0 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void BuyMenu_Main_7( void ) {
sendevent( "GamePlayerBuyAmmo", "f", 1 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void BuyMenu_Main_8( void ) {
fVGUI_Display = VGUI_BM_EQUIPMENT;
pSeat->fVGUI_Display = VGUI_BM_EQUIPMENT;
}
static void BuyMenu_Main_9( void ) {
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
VGUI_Button( _("VGUI_TITLE_HANDGUN"), BuyMenu_Main_1, vPos + '16 116 0', '180 24 0' );
@ -103,7 +103,7 @@ void VGUI_BuyMenu_Main( vector vPos ) {
}
void VGUI_BuyMenu_Back( void ) {
fVGUI_Display = VGUI_BM_MAIN;
pSeat->fVGUI_Display = VGUI_BM_MAIN;
}
/*
@ -117,7 +117,7 @@ float iLastSelected;
void VGUI_BuyMenu_BuyWeapon( void ) {
if( iLastSelected ) {
sendevent( "PlayerBuyWeapon", "f", iLastSelected );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
}
@ -128,7 +128,7 @@ VGUI_BuyMenu_BuyEquipment
*/
void VGUI_BuyMenu_BuyEquipment( void ) {
sendevent( "PlayerBuyEquipment", "f", iLastSelected );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
/*

View File

@ -34,7 +34,7 @@ an array of infokeys, but that'll clutter things up
*/
void VGUI_MessageOfTheDay( vector vPos ) {
static void MessageOfTheDay_ButtonOK( void ) {
fVGUI_Display = VGUI_TEAMSELECT;
pSeat->fVGUI_Display = VGUI_TEAMSELECT;
}
VGUI_Text( serverkey( "hostname" ), vPos + '16 64 0', '16 16', FONT_16 );

View File

@ -68,7 +68,7 @@ void VGUI_Radio_DrawCommand( float fIndex, float fMessage, vector vPos ) {
if ( fInputKeyCode == ( fIndex + 49 ) ) {
sendevent( "RadioMessage", "f", fMessage );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
}
@ -82,10 +82,10 @@ Main drawing routine for the radio menus
void VGUI_Radio_Draw( void ) {
vector vSize, vPos;
if ( fVGUI_Display == VGUI_RADIO1 ) {
if ( pSeat->fVGUI_Display == VGUI_RADIO1 ) {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_COMMANDS ) + 64;
vPos = [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE1"), vPos, vSize );
@ -95,10 +95,10 @@ void VGUI_Radio_Draw( void ) {
vPos_y += 10;
VGUI_Radio_DrawCommand( i, fRadioCommands[ i ], vPos );
}
} else if ( fVGUI_Display == VGUI_RADIO2 ) {
} else if ( pSeat->fVGUI_Display == VGUI_RADIO2 ) {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_GROUPCOMMANDS ) + 64;
vPos = [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE2"), vPos, vSize );
@ -111,7 +111,7 @@ void VGUI_Radio_Draw( void ) {
} else {
vSize_x = 312;
vSize_y = ( 10 * VGUIRADIO_RESPONSES ) + 64;
vPos = [ 16, vVideoResolution_y - 148 - vSize_y ];
vPos = vVideoMins + [ 16, vVideoResolution_y - 148 - vSize_y ];
VGUI_WindowSmall( _("RADIO_TITLE3"), vPos, vSize );
@ -127,7 +127,7 @@ void VGUI_Radio_Draw( void ) {
VGUI_Text( sprintf( "0) %s", _("VGUI_BACK") ), vPos, '8 8', FONT_DEFAULT );
if ( fInputKeyCode == 48 ) {
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
}
@ -141,9 +141,9 @@ void VGUI_Radio_Toggle( float fMenu ) {
return;
}
if ( fVGUI_Display == fMenu ) {
fVGUI_Display = VGUI_NONE;
if ( pSeat->fVGUI_Display == fMenu ) {
pSeat->fVGUI_Display = VGUI_NONE;
} else {
fVGUI_Display = fMenu;
pSeat->fVGUI_Display = fMenu;
}
}

View File

@ -27,9 +27,6 @@ string sScoreTeams[4] = {
_("SCORE_TITLE_VIP"),
};
// This is seperated from the other VGUI stuff so we can check scores while buying and whatnot
int iShowScores;
/*
====================
VGUI_Scores_DrawTeam
@ -120,8 +117,9 @@ void VGUI_Scores_Show( void ) {
vSize_x = 540;
vSize_y = vVideoResolution_y - 112;
vMainPos_x = ( vVideoResolution_x / 2 ) - (vSize_x / 2);
vMainPos_y = 56;
vMainPos = vVideoMins;
vMainPos_x += ( vVideoResolution_x / 2 ) - (vSize_x / 2);
vMainPos_y += 56;
// Draw the background
drawfill( vMainPos, vSize, VGUI_WINDOW_BGCOLOR, VGUI_WINDOW_BGALPHA );

View File

@ -29,8 +29,8 @@ void VGUI_DrawSpectatorHUD( void ) {
vHUDColor = autocvar_con_color * ( 1 / 255 );
// Draw the borders
drawfill( [ 0, 0 ], [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( [ 0, vVideoResolution_y - 40], [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( vVideoMins, [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( vVideoMins + [ 0, vVideoResolution_y - 40], [ vVideoResolution_x, 40 ], '0 0 0', 1 );
// Draw the timer
int iMinutes, iSeconds, iTens, iUnits;
@ -51,17 +51,17 @@ void VGUI_DrawSpectatorHUD( void ) {
iUnits = iSeconds - 10 * iTens;
}
drawpic( [ vVideoResolution_x - 70, 20 ], "gfx/vgui/640_timer", '14 14', '1 1 1', 1 );
VGUI_RightText( [ vVideoResolution_x - 16, 23 ], sprintf( "%i:%i%i", iMinutes, iTens, iUnits ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
drawpic( vVideoMins + [ vVideoResolution_x - 70, 20 ], "gfx/vgui/640_timer", '14 14', '1 1 1', 1 );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 16, 23 ], sprintf( "%i:%i%i", iMinutes, iTens, iUnits ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
// Draw the money
CSQC_DrawText( [ vVideoResolution_x - 67, 6 ], "$", '8 8', '0.56 0.56 0.21', 1, 0, FONT_DEFAULT );
VGUI_RightText( [ vVideoResolution_x - 16, 6 ], sprintf( "%d", getstatf( STAT_MONEY ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
CSQC_DrawText( vVideoMins + [ vVideoResolution_x - 67, 6 ], "$", '8 8', '0.56 0.56 0.21', 1, 0, FONT_DEFAULT );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 16, 6 ], sprintf( "%d", getstatf( STAT_MONEY ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
// Seperator
drawfill( [ vVideoResolution_x - 85, 6 ], [ 2, 28 ], '0.56 0.56 0.21', 1 );
drawfill( vVideoMins + [ vVideoResolution_x - 85, 6 ], [ 2, 28 ], '0.56 0.56 0.21', 1 );
// Team Stats
VGUI_RightText( [ vVideoResolution_x - 96, 6 ], sprintf( _("VGUI_SPEC_TCOUNTER"), getstatf( STAT_WON_T ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
VGUI_RightText( [ vVideoResolution_x - 96, 23 ], sprintf( _("VGUI_SPEC_CTCOUNTER"), getstatf( STAT_WON_CT ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 96, 6 ], sprintf( _("VGUI_SPEC_TCOUNTER"), getstatf( STAT_WON_T ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
VGUI_RightText( vVideoMins + [ vVideoResolution_x - 96, 23 ], sprintf( _("VGUI_SPEC_CTCOUNTER"), getstatf( STAT_WON_CT ) ), '8 8', '0.56 0.56 0.21', FONT_DEFAULT );
}

View File

@ -93,10 +93,10 @@ VGUI_TeamSelect_Main
*/
void VGUI_TeamSelect_Main( vector vPos ) {
static void TeamSelect_Main_ButtonT( void ) {
fVGUI_Display = VGUI_TEAM_T;
pSeat->fVGUI_Display = VGUI_TEAM_T;
}
static void TeamSelect_Main_ButtonCT( void ) {
fVGUI_Display = VGUI_TEAM_CT;
pSeat->fVGUI_Display = VGUI_TEAM_CT;
}
static void TeamSelect_Main_ButtonAuto( void ) {
int iPlayersT = 0;
@ -111,17 +111,17 @@ void VGUI_TeamSelect_Main( vector vPos ) {
}
if ( iPlayersCT > iPlayersT ) {
fVGUI_Display = VGUI_TEAM_T;
pSeat->fVGUI_Display = VGUI_TEAM_T;
} else {
fVGUI_Display = VGUI_TEAM_CT;
pSeat->fVGUI_Display = VGUI_TEAM_CT;
}
}
static void TeamSelect_Main_ButtonSpectate( void ) {
sendevent( "GamePlayerSpawn", "f", 0 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_Main_Exit( void ) {
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
VGUI_Text( sMapString[ 0 ], vPos + '16 64 0', '16 16', FONT_16);
@ -147,7 +147,7 @@ VGUI_TeamSelect_Back
====================
*/
void VGUI_TeamSelect_Back( void ) {
fVGUI_Display = VGUI_TEAMSELECT;
pSeat->fVGUI_Display = VGUI_TEAMSELECT;
}
/*
@ -176,19 +176,19 @@ VGUI_TeamSelect_T
void VGUI_TeamSelect_T( vector vPos ) {
static void TeamSelect_T1( void ) {
sendevent( "GamePlayerSpawn", "f", 1 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_T2( void ) {
sendevent( "GamePlayerSpawn", "f", 2 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_T3( void ) {
sendevent( "GamePlayerSpawn", "f", 3 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_T4( void ) {
sendevent( "GamePlayerSpawn", "f", 4 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
VGUI_TeamSelect_Button( 0, TeamSelect_T1, vPos + '16 160 0', '180 24 0' );
@ -206,19 +206,19 @@ VGUI_TeamSelect_CT
void VGUI_TeamSelect_CT ( vector vPos ) {
static void TeamSelect_CT1( void ) {
sendevent( "GamePlayerSpawn", "f", 5 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_CT2( void ) {
sendevent( "GamePlayerSpawn", "f", 6 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_CT3( void ) {
sendevent( "GamePlayerSpawn", "f", 7 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
static void TeamSelect_CT4( void ) {
sendevent( "GamePlayerSpawn", "f", 8 );
fVGUI_Display = VGUI_NONE;
pSeat->fVGUI_Display = VGUI_NONE;
}
VGUI_TeamSelect_Button( 4, TeamSelect_CT1, vPos + '16 160 0', '180 24 0' );

View File

@ -18,10 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
entity eViewModel;
entity eMuzzleflash;
float fNumBones;
string sViewModels[ CS_WEAPON_COUNT - 1 ] = {
"models/v_knife.mdl",
"models/v_usp.mdl",
@ -57,19 +53,17 @@ string sViewModels[ CS_WEAPON_COUNT - 1 ] = {
View_CalcBob
====================
*/
float View_CalcBob( void ) {
static float fBobTime;
static float fBob;
void View_CalcBob( void ) {
float fCycle;
vector vVelocity;
if ( self.flags & FL_ONGROUND == -1 ) {
return fBob;
return;
}
fBobTime += frametime;
fCycle = fBobTime - (int)( fBobTime / autocvar_cl_bobcycle ) * autocvar_cl_bobcycle;
pSeat->fBobTime += frametime;
fCycle = pSeat->fBobTime - (int)( pSeat->fBobTime / autocvar_cl_bobcycle ) * autocvar_cl_bobcycle;
fCycle /= autocvar_cl_bobcycle;
if ( fCycle < autocvar_cl_bobup ) {
@ -78,25 +72,22 @@ float View_CalcBob( void ) {
fCycle = MATH_PI + MATH_PI * ( fCycle - autocvar_cl_bobup )/( 1.0 - autocvar_cl_bobup );
}
vVelocity = vPlayerVelocity;
vVelocity = pSeat->vPlayerVelocity;
vVelocity_z = 0;
fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * autocvar_cl_bob;
float fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * autocvar_cl_bob;
fBob = fBob * 0.3 + fBob * 0.7 * sin( fCycle );
fBob = min( fBob, 4 );
fBob = max( fBob, -7 );
return fBob;
pSeat->fBob = bound( -7, fBob, 4 );
}
void View_DropPunchAngle( void ) {
float fLerp;
fLerp = 1.0f - ( frametime * 4 );
vPunchAngle *= fLerp;
pSeat->vPunchAngle *= fLerp;
}
void View_AddPunchAngle( vector vAdd ) {
vPunchAngle += vAdd;
pSeat->vPunchAngle += vAdd;
}
/*
@ -108,25 +99,25 @@ void View_ProcessEvent( float fTimeStamp, int iCode, string sData ) {
if ( iCode == 5004 ) {
localsound( sData, CHAN_AUTO, 1.0 );
} else if ( iCode == 5001 ) {
eMuzzleflash.alpha = 1.0f;
eMuzzleflash.scale = 0.5;
eMuzzleflash.skin = fNumBones;
setmodel( eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
} else if( iCode == 5011 ) {
eMuzzleflash.alpha = 1.0f;
eMuzzleflash.scale = 0.5;
eMuzzleflash.skin = fNumBones + 1;
setmodel( eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 1;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
} else if ( iCode == 5021 ) {
eMuzzleflash.alpha = 1.0f;
eMuzzleflash.scale = 0.5;
eMuzzleflash.skin = fNumBones + 2;
setmodel( eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 2;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
} else if ( iCode == 5031 ) {
eMuzzleflash.alpha = 1.0f;
eMuzzleflash.scale = 0.5;
eMuzzleflash.skin = fNumBones + 3;
setmodel( eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
pSeat->eMuzzleflash.alpha = 1.0f;
pSeat->eMuzzleflash.scale = 0.5;
pSeat->eMuzzleflash.skin = pSeat->fNumBones + 3;
setmodel( pSeat->eMuzzleflash, sprintf( "sprites/muzzleflash%s.spr", substring( sData, 1, 1 ) ) );
}
}
@ -136,52 +127,54 @@ View_DrawViewModel
====================
*/
void View_DrawViewModel( void ) {
static float fBob;
static float fLastWeapon;
if( !eViewModel ) {
eViewModel = spawn();
eViewModel.renderflags = RF_DEPTHHACK;
if( !pSeat->eViewModel ) {
pSeat->eViewModel = spawn();
pSeat->eViewModel.classname = "view model";
pSeat->eViewModel.renderflags = RF_VIEWMODEL | RF_DEPTHHACK;
eMuzzleflash = spawn();
eMuzzleflash.renderflags = RF_DEPTHHACK | RF_ADDITIVE;
pSeat->eMuzzleflash = spawn();
pSeat->eMuzzleflash.classname = "view muzzleflash";
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_DEPTHHACK | RF_ADDITIVE;
}
entity eViewModel = pSeat->eViewModel;
entity eMuzzleflash = pSeat->eMuzzleflash;
if ( getstatf( STAT_HEALTH ) <= 0 ) {
return;
}
// Don't update when paused
if ( serverkey("pausestate") == "0" ) {
fBob = View_CalcBob();
if( getstatf( STAT_ACTIVEWEAPON ) < CS_WEAPON_COUNT ) {
if ( fLastWeapon != getstatf( STAT_ACTIVEWEAPON ) ) {
fLastWeapon = getstatf( STAT_ACTIVEWEAPON );
if ( fLastWeapon ) {
setmodel( eViewModel, sViewModels[ getstatf( STAT_ACTIVEWEAPON ) - 1 ] );
View_CalcBob();
int aw = getstati( STAT_ACTIVEWEAPON );
if( aw < CS_WEAPON_COUNT ) {
if ( pSeat->fLastWeapon != aw ) {
pSeat->fLastWeapon = aw;
if ( aw >= 1 ) {
setmodel( eViewModel, sViewModels[ aw - 1 ] );
skel_delete( eMuzzleflash.skeletonindex );
eMuzzleflash.skeletonindex = skel_create( eViewModel.modelindex );
fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
pSeat->fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
}
}
}
// Take away alpha once it has drawn fully at least once
if ( eMuzzleflash.alpha > 0.0f ) {
eMuzzleflash.alpha -= ( frametime * 45 );
}
static float fBaseTime;
processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, View_ProcessEvent );
float fBaseTime = eViewModel.frame1time;
eViewModel.frame1time += frametime;
eViewModel.frame2time += frametime;
processmodelevents( eViewModel.modelindex, eViewModel.frame, fBaseTime, eViewModel.frame1time, View_ProcessEvent );
}
makevectors( getproperty( VF_ANGLES ) );
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * ( fBob * 0.4 ) );
eViewModel.angles = getproperty( VF_ANGLES ) + vPunchAngle;
makevectors( '0 0 0');
eViewModel.origin = '0 0 -1' + ( v_forward * ( pSeat->fBob * 0.4 ) );
eViewModel.angles = pSeat->vPunchAngle;
// Left-handed weapons
if ( autocvar_v_lefthanded ) {
@ -197,7 +190,7 @@ void View_DrawViewModel( void ) {
// Give the gun a tilt effect like in old HL/CS versions
if ( autocvar_cl_bobclassic == 1 ) {
eViewModel.angles_z = -fBob;
eViewModel.angles_z = -pSeat->fBob;
}
// Only bother when zoomed out
@ -219,6 +212,6 @@ View_DrawViewModel
====================
*/
void View_PlayAnimation( int iSequence ) {
eViewModel.frame = (float)iSequence;
eViewModel.frame1time = 0.0f;
pSeat->eViewModel.frame = (float)iSequence;
pSeat->eViewModel.frame1time = 0.0f;
}

View File

@ -46,6 +46,7 @@
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\FuncHostageRescue.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\FuncLadder.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\FuncPushable.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\FuncVehicle.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\FuncVIPSafetyZone.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Input.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Light.c" />

View File

@ -18,6 +18,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma target FTE
//#pragma flag enable lo //enable short-circuiting
#define VEC_HULL_MIN '-16 -16 -36'
#define VEC_HULL_MAX '16 16 36'
@ -287,25 +290,13 @@ enum {
#define INPUT_BUTTON5 16
#define INPUT_BUTTON6 32
#define FL_USERELEASED 8192
#define FL_CROUCHING 16384
#define FL_SEMI_TOGGLED 32768
#define FL_FROZEN 131072
#define FL_REMOVEME 262144
#define FL_USERELEASED (1<<13)
#define FL_CROUCHING (1<<19)
#define FL_SEMI_TOGGLED (1<<15)
#define FL_FROZEN (1<<17)
#define FL_REMOVEME (1<<18)
float clamp(float d, float imin, float imax) {
float t;
if(d < imin)
t = imin;
else
t = d;
if(t > imax)
return imax;
else
return t;
}
#define clamp(d,min,max) bound(min,d,max)
void Empty( void ) { }
void BaseGun_ShotMultiplierHandle( float fShots );

24
Source/Math.h Normal file → Executable file
View File

@ -63,3 +63,27 @@ float Math_FixDelta( float fDelta ) {
float Math_CRandom( void ) {
return 2 * ( random() - 0.5 );
}
#if defined(SSQC) || defined(CSQC)
#ifdef SSQC
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos, int iSkipArmor );
#endif
.float health;
void runplayerphysics(void)
{ //operates on self
float fallvel = ( self.flags & FL_ONGROUND )?0:-self.velocity_z;
runstandardplayerphysics(self);
if ( ( self.flags & FL_ONGROUND ) && ( self.health > 0 ) && ( fallvel > 100 )) {
#ifdef SSQC
if ( fallvel > 580 ) {
float fFallDamage = (fallvel-580) * ( 200 / ( 1024 - 580 ) );
Damage_Apply( self, world, fFallDamage, self.origin, FALSE );
}
#endif
if ( fallvel > 200 ) {
self.velocity *= 0.25;
}
}
}
#endif

0
Source/Menu/Defs.h Normal file → Executable file
View File

0
Source/Menu/Draw.c Normal file → Executable file
View File

0
Source/Menu/Header.c Normal file → Executable file
View File

0
Source/Menu/Init.c Normal file → Executable file
View File

0
Source/Menu/Makefile Normal file → Executable file
View File

0
Source/Menu/MenuMain.c Normal file → Executable file
View File

94
Source/Menu/MenuMultiplayer.c Normal file → Executable file
View File

@ -244,20 +244,106 @@ void Menu_Multiplayer_Create( void ) {
void Menu_Multiplayer_IRC( void ) {
static int iIRCInit = FALSE;
static string currenttab;
string showtab;
static string s; //static to access it in nested functions.
static void IRC_ButtonDone( void ) {
iMenu = MENU_MULTIPLAYER;
}
static void IRC_ButtonSelect(void) {
if (currenttab)
con_input(currenttab, IE_FOCUS, 0/*mouse focus*/, 0/*key focus*/, 0);
if (s)
{
currenttab = s;
con_input(currenttab, IE_FOCUS, 1/*mouse focus*/, 1/*key focus*/, 0);
}
}
if ( iIRCInit == FALSE ) {
print( "[IRC] Connecting to #freecs...\n" );
con_printf( "IRC", "/irc /connect irc.freenode.org #freecs\n" );
//con_getset( "IRC", "hidden", "1" );
localcmd("/irc /connect irc.freenode.org #freecs\n");
iIRCInit = TRUE;
for (string s = ""; s; s = con_getset("", "next")) {con_printf(s, "SPAMMING EVERY CONSOLE HAR HAR HAR\n");}
}
int iTabIdx;
vector vTabPos = '196 140';
for (s = "", iTabIdx = 0; s; s = con_getset(s, "next"))
{
if (substring(s, 0, 3) == "IRC")
{
con_getset( s, "hidden", "1" ); //Hide all IRC consoles. We're evil like that.
string title = con_getset( s, "title" );
iTabIdx++;
if (fButtonAlpha[iTabIdx] < 0.5)
fButtonAlpha[iTabIdx] = 0.5;
Object_TextButton( vTabPos, title, IRC_ButtonSelect, fButtonAlpha[iTabIdx] );
vTabPos_x += stringwidth(title, TRUE, '8 8') + 8;
}
}
//TODO: scroll tabs.
//TODO: add a close button
//TODO: make it friendly when in-game.
showtab = currenttab;
if not (showtab) //the channel we're trying to target
for (s = ""; s; s = con_getset(s, "next"))
{ //try to find our target channel
if (substring(s, 0, 3) == "IRC" && substring(s, -8, -1) == ":#freecs")
{
showtab = s;
break;
}
}
if (!showtab) //the server-messages channel. used more as a loading screen than anything else.
for (s = ""; s; s = con_getset(s, "next"))
{
if (substring(s, 0, 3) == "IRC" && substring(s, -1, -1) == ":")
{
showtab = s;
break;
}
}
//TODO: propagate input events to the currenttab.
if (currenttab)
{
if (Menu_InputCheckMouse( vMenuOffset + '196 148', '404 308' ))
{
con_input(currenttab, IE_MOUSEABS, vMousePos_x, vMousePos_y, 0);
if (fMouseClick)
{
con_input(currenttab, IE_KEYDOWN, K_MOUSE1, 0, 0);
con_input(currenttab, IE_KEYUP, K_MOUSE1, 0, 0);
}
con_input(currenttab, IE_FOCUS, 1/*mouse focus*/, 1/*key focus*/, 0);
}
else
con_input(currenttab, IE_FOCUS, 0/*mouse focus*/, 1/*key focus*/, 0);
//this is hideous
//BUG BUG BUG FIXME: The engine attempts to restrict con_input inputs.
//as a result, it can only be called inside CSQC_Input_Event (or menuqc equivelents)
//note that if you wish to handle IME strings then you should be doing that anyway.
if (fInputKeyCode != K_MOUSE1 && (fInputKeyCode || fInputKeyASCII))
{
//print(sprintf("Sending input: %f %f %c\n", fInputKeyCode, fInputKeyASCII, fInputKeyASCII));
con_input(currenttab, IE_KEYDOWN, fInputKeyCode, fInputKeyASCII, 0);
con_input(currenttab, IE_KEYUP, fInputKeyCode, fInputKeyASCII, 0);
fInputKeyCode = 0;
fInputKeyASCII = 0;
}
}
con_draw( "IRC", vMenuOffset + '196 140', '404 308', 8 );
if (showtab)
con_draw( showtab, vMenuOffset + '196 148', '404 308', 8 );
else
Object_Label( '196 148', _("No IRC Output"), '8 8' );
Object_Button( '32 308', BTN_DONE, IRC_ButtonDone, fButtonAlpha[0] );
}

30
Source/Menu/Objects.c Normal file → Executable file
View File

@ -132,6 +132,36 @@ void Object_Button( vector vPosition, int iButtonID, void() vFunction, __inout f
drawsubpic( vPosition, '156 26', "gfx/shell/btns_main", vSrcPos + [ 0, 52 / vMenuButtonsSize_y ], vSrcSize, '1 1 1', fAlpha, 1 );
}
void Object_TextButton( vector vPosition, string sButtonText, void() vFunction, __inout float fAlpha ) {
static string sLastButton;
vPosition += vMenuOffset;
if ( fAlpha > 0.0f ) {
fAlpha -= frametime;
} else {
fAlpha = 0.0f;
}
if ( Menu_InputCheckMouse( vPosition, [stringwidth(sButtonText, TRUE, '8 8'), 8] ) == TRUE ) {
if ( sLastButton != sButtonText ) {
localcmd( "play ../media/launch_deny2.wav\n" );
}
sLastButton = sButtonText;
fAlpha = 1.0f;
if ( fMouseClick == TRUE ) {
if ( vFunction != __NULL__ ) {
vFunction();
}
localcmd( "play ../media/launch_select2.wav\n" );
fMouseClick = FALSE;
}
}
drawstring( vPosition, sButtonText, '8 8', '1 1 1', fAlpha, 1 );
}
/*
=================
Object_Frame

0
Source/Menu/progs.src Normal file → Executable file
View File

View File

@ -136,7 +136,7 @@ void SV_RunClientCommand( void ) {
input_impulse = 0;
}
runstandardplayerphysics( self );
runplayerphysics();
}
/*

0
Source/Server/Damage.c Normal file → Executable file
View File

View File

@ -65,7 +65,7 @@ enum {
.int iInGame;
.float fCharModel;
.int iCrouchAttempt;
.int iHasBomb;
//.int iHasBomb;
.float fDeaths;
.int iEquipment;
.float armor;
@ -87,7 +87,6 @@ float fGameTime;
.float fAttackFinished;
.float fRadioFinished;
.float fAccuracy;
.float fFallVelocity;
// Game specific fields
int iHostagesMax;

View File

@ -36,7 +36,7 @@ void Footsteps_Update( void ) {
return;
}
if ( self.movement_x < 200 || self.flags & FL_CROUCHING ) {
if ( vlen( self.movement ) < 150 || self.flags & FL_CROUCHING ) {
return;
}

View File

@ -30,8 +30,13 @@ void SV_SendChat( entity eSender, string sMessage, entity eEnt, float fType ) {
WriteByte( MSG_MULTICAST, num_for_edict( eSender ) - 1 );
WriteByte( MSG_MULTICAST, eSender.team );
WriteString( MSG_MULTICAST, sMessage );
msg_entity = eEnt;
multicast( '0 0 0', MULTICAST_ONE );
if (eEnt)
{
msg_entity = eEnt;
multicast( '0 0 0', MULTICAST_ONE );
}
else
multicast( '0 0 0', MULTICAST_ALL );
}
/*
@ -49,9 +54,7 @@ void SV_ParseClientCommand( string sCommand ) {
if ( self.health ) {
if ( argv( 0 ) == "say" ) {
localcmd( sprintf( "echo %s: %s\n", self.netname, argv( 1 ) ) );
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
SV_SendChat( self, argv( 1 ), eFind, 0 );
}
SV_SendChat( self, argv( 1 ), world, 0 );
return;
} else if ( argv( 0 ) == "say_team" ) {
localcmd( sprintf( "echo [TEAM %d] %s: %s\n", self.team, self.netname, argv( 1 ) ) );

0
Source/Server/Makefile Normal file → Executable file
View File

View File

@ -147,7 +147,7 @@ void Player_Death( int iHitBody ) {
if ( ( iAlivePlayers_T == 0 ) && ( iAlivePlayers_CT == 0 ) ) {
if ( ( iBombPlanted == FALSE ) || ( iBombZones > 0 ) ) {
Rules_RoundOver( FALSE, 3600, FALSE );
Rules_RoundOver( FALSE, 0, FALSE );
} else {
Rules_RoundOver( TEAM_T, 3600, FALSE );
}
@ -299,10 +299,6 @@ Run before physics
void PlayerPreThink( void ) {
Input_Handle();
BaseGun_ShotMultiplierUpdate();
if ( !( self.flags & FL_ONGROUND ) ){
self.fFallVelocity = -self.velocity_z;
}
}
/*
@ -316,18 +312,5 @@ void PlayerPostThink( void ) {
Animation_PlayerUpdate();
Footsteps_Update();
if ( ( self.flags & FL_ONGROUND ) && ( self.health > 0 ) && ( self.fFallVelocity > 100 )) {
if ( self.fFallVelocity > 580 ) {
self.fFallVelocity -= 580;
float fFallDamage = self.fFallVelocity * ( 200 / ( 1024 - 580 ) );
Damage_Apply( self, world, fFallDamage, self.origin, FALSE );
}
if ( self.fFallVelocity > 200 ) {
self.velocity *= 0.25;
}
self.fFallVelocity = 0;
}
self.SendFlags = 1;
}

View File

@ -179,11 +179,16 @@ void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
Radio_BroadcastMessage( RADIO_TERWIN );
}
iWon_T++;
// FIXME: Calculate the proper loss values
Money_QueTeamReward( TEAM_CT, 1400 );
} else if ( iTeamWon == TEAM_CT ) {
if ( fSilent == FALSE ) {
Radio_BroadcastMessage( RADIO_CTWIN );
}
iWon_CT++;
// FIXME: Calculate the proper loss values
Money_QueTeamReward( TEAM_T, 1400 );
} else {
if ( fSilent == FALSE ) {
Radio_BroadcastMessage( RADIO_ROUNDDRAW );

View File

@ -47,9 +47,14 @@ entity Spawn_FindSpawnPoint( float fTeam ) {
while ( 1 ) {
eSpot = find(eSpot, classname, sClassname);
if (eSpot == eLastSpawn)
{ //fall back on lame cycling/spawnfragging
eLastSpawn = find(eLastSpawn, classname, sClassname);
if (!eLastSpawn)
eLastSpawn = find(eLastSpawn, classname, sClassname);
return eLastSpawn;
}
if (eSpot != world) {
if (eSpot == eLastSpawn)
return eLastSpawn;
iCount = 0;
eThing = findradius(eSpot.origin, 32);
while(eThing) {

View File

@ -23,8 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.float fWasCrouching;
// For lerping, sigh
#ifdef CSQC
.float frame_last;
.float baseframe_last;
#endif
enum {
ANIM_DUMMY1,

View File

@ -52,9 +52,7 @@ weaponinfo_t wptTable[ CS_WEAPON_COUNT ] = {
#ifdef SSQC
.int iShotMultiplier;
.float fDecreaseShotTime;
.int iOldShotMultiplier;
#else
int iShotMultiplier;
//.int iOldShotMultiplier;
#endif
/*
@ -72,13 +70,13 @@ void BaseGun_ShotMultiplierHandle( float fShots ) {
self.fDecreaseShotTime = time + 0.2;
#else
vector vPunch;
if ( iShotMultiplier > 12 ) {
iShotMultiplier = 12;
if ( pSeat->iShotMultiplier > 12 ) {
pSeat->iShotMultiplier = 12;
} else {
iShotMultiplier += fShots;
pSeat->iShotMultiplier += fShots;
}
vPunch_x = -2 * ( iShotMultiplier / 6 );
vPunch_x = -2 * ( pSeat->iShotMultiplier / 6 );
vPunch_y = random( -1, 1 );
View_AddPunchAngle( vPunch );
#endif

View File

@ -293,6 +293,7 @@ void Effect_BreakModel( vector vMins, vector vMaxs, vector vVel, float fStyle )
while ( fCount > 0 ) {
entity eGib = spawn();
eGib.classname = "gib";
vPos_x = vMins_x + ( random() * ( vMaxs_x - vMins_x ) );
vPos_y = vMins_y + ( random() * ( vMaxs_y - vMins_y ) );

View File

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.int iMag_ELITES;
#ifdef SSQC
.int iMode_ELITES;
//.int iMode_ELITES;
#else
int iWeaponMode_ELITES;
#endif

0
Source/Shared/WeaponG3SG1.c Normal file → Executable file
View File

Binary file not shown.

View File

@ -38,7 +38,7 @@ seta sv_maxspeed 240
seta cl_forwardspeed 240
seta cl_sidespeed 240
seta cl_backspeed 240
seta cl_movespeedkey 0.2
seta cl_movespeedkey 0.5
seta mp_startmoney "800"
seta mp_buytime 90
seta mp_freezetime 6
@ -76,4 +76,5 @@ seta scr_conalpha "1"
seta con_notifylines "0"
seta maxplayers "8"
seta lang "en_us"
seta cfg_save_auto "1"
seta cfg_save_auto "1"
seta in_rawinput "1"

Binary file not shown.

Binary file not shown.