Fixed some rendering-frame bugs (stuff that doesn't belong...)
and fixed up pmove a little bit.
This commit is contained in:
parent
c1e4f170a1
commit
99c878d4d0
22 changed files with 203 additions and 262 deletions
|
@ -252,7 +252,7 @@ void CSQC_UpdateView(float fWinWidth, float fWinHeight, float fGameFocus) {
|
|||
traceline(vStart, vEnd, FALSE, self);
|
||||
setproperty(VF_ORIGIN, trace_endpos + (v_forward * 5));
|
||||
} else {
|
||||
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + [0, 0, getstatf(STAT_VIEWHEIGHT)]);
|
||||
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin + self.view_ofs);
|
||||
}
|
||||
} else {
|
||||
setproperty(VF_ORIGIN, pSeat->vPlayerOrigin);
|
||||
|
@ -270,6 +270,7 @@ void CSQC_UpdateView(float fWinWidth, float fWinHeight, float fGameFocus) {
|
|||
View_DropPunchAngle();
|
||||
Fade_Update((int)vVideoMins[0],(int)vVideoMins[1], (int)fWinWidth, (int)fWinHeight);
|
||||
Nightvision_PostDraw((int)vVideoMins[0],(int)vVideoMins[1], (int)fWinWidth, (int)fWinHeight);
|
||||
View_PostDraw();
|
||||
|
||||
if(fGameFocus == TRUE) {
|
||||
GameText_Draw();
|
||||
|
|
|
@ -83,6 +83,7 @@ void CSQC_Ent_Update( float flIsNew ) {
|
|||
self.weapon = readbyte();
|
||||
self.health = readbyte();
|
||||
self.movetype = readfloat();
|
||||
self.view_ofs[2] = readfloat();
|
||||
setorigin( self, self.origin );
|
||||
|
||||
if (self.health < self.oldhealth) {
|
||||
|
|
|
@ -662,7 +662,7 @@ void CSQC_Input_Frame(void) {
|
|||
}
|
||||
|
||||
if (iInputDuck == TRUE) {
|
||||
input_buttons|= INPUT_BUTTON8;
|
||||
input_buttons |= INPUT_BUTTON8;
|
||||
}
|
||||
|
||||
input_angles += pSeat->vPunchAngle;
|
||||
|
|
|
@ -31,72 +31,70 @@ HUD_DrawCrosshair
|
|||
Draws the cursor every frame, unless spectator
|
||||
=================
|
||||
*/
|
||||
void HUD_DrawCrosshair( void ) {
|
||||
void HUD_DrawCrosshair(void) {
|
||||
int iCrosshairDistance;
|
||||
int iLineLength;
|
||||
|
||||
|
||||
// Weapon Info Tables have got Mins and Deltas they are willing to share
|
||||
float fDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairMinDistance;
|
||||
float fDeltaDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairDeltaDistance;
|
||||
|
||||
if ( iNightVision == FALSE ) {
|
||||
vCrossColor = autocvar_cross_color * ( 1 / 255 );
|
||||
float fDistance = wptTable[getstatf(STAT_ACTIVEWEAPON)].iCrosshairMinDistance;
|
||||
float fDeltaDistance = wptTable[getstatf(STAT_ACTIVEWEAPON)].iCrosshairDeltaDistance;
|
||||
|
||||
if (iNightVision == FALSE) {
|
||||
vCrossColor = autocvar_cross_color * (1 / 255);
|
||||
} else {
|
||||
vCrossColor = '1 0 0';
|
||||
vCrossColor = [1.0f,0.0f,0.0f];
|
||||
}
|
||||
|
||||
if ( !( getstatf( STAT_FLAGS ) & FL_ONGROUND) ) { // If we are in the air...
|
||||
|
||||
if (!(getstatf(STAT_FLAGS) & FL_ONGROUND)) { // If we are in the air...
|
||||
fDistance = fDistance * 2;
|
||||
} else if ( getstatf( STAT_FLAGS ) & FL_CROUCHING ) { // Crouching...
|
||||
} else if (getstatf(STAT_FLAGS) & FL_CROUCHING) { // Crouching...
|
||||
fDistance = fDistance * 0.5;
|
||||
} else if ( vlen( pSeat->ePlayer.velocity ) > 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 ( pSeat->iShotMultiplier > pSeat->iOldShotMultiplier ) {
|
||||
pSeat->fCrosshairDistance = min( 15, pSeat->fCrosshairDistance + fDeltaDistance );
|
||||
} else if ( pSeat->fCrosshairDistance > fDistance ) {
|
||||
if (pSeat->iShotMultiplier > pSeat->iOldShotMultiplier) {
|
||||
pSeat->fCrosshairDistance = min(15, pSeat->fCrosshairDistance + fDeltaDistance);
|
||||
} else if (pSeat->fCrosshairDistance > fDistance) {
|
||||
// Slowly decrease the distance again
|
||||
pSeat->fCrosshairDistance -= ( pSeat->fCrosshairDistance * frametime );
|
||||
pSeat->fCrosshairDistance -= (pSeat->fCrosshairDistance * frametime);
|
||||
|
||||
if ( ( pSeat->iShotMultiplier > 0 ) && ( pSeat->fDecreaseShotTime < time ) ) {
|
||||
if ((pSeat->iShotMultiplier > 0) && (pSeat->fDecreaseShotTime < time)) {
|
||||
pSeat->fDecreaseShotTime = time + 0.2;
|
||||
pSeat->iShotMultiplier--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pSeat->iOldShotMultiplier = pSeat->iShotMultiplier;
|
||||
|
||||
if ( pSeat->fCrosshairDistance < fDistance ) {
|
||||
if (pSeat->fCrosshairDistance < fDistance) {
|
||||
pSeat->fCrosshairDistance = fDistance;
|
||||
}
|
||||
|
||||
iCrosshairDistance = ceil( pSeat->fCrosshairDistance );
|
||||
iLineLength = ( ( iCrosshairDistance - fDistance ) / 2 ) + 5;
|
||||
iCrosshairDistance = ceil(pSeat->fCrosshairDistance);
|
||||
iLineLength = max(1, ((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;
|
||||
|
||||
// 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 );
|
||||
|
||||
drawfill( vVer1, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vVer2, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor1, [ iLineLength, 1 ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor2, [ iLineLength, 1 ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
// Vertical Lines
|
||||
vVer1[0] += (vVideoResolution[0] / 2);
|
||||
vVer1[1] += (vVideoResolution[1] / 2) - (iCrosshairDistance + iLineLength);
|
||||
vVer2[0] += (vVideoResolution[0] / 2);
|
||||
vVer2[1] += (vVideoResolution[1] / 2) + iCrosshairDistance + 1;
|
||||
|
||||
// Horizontal Lines
|
||||
vHor1[0] += (vVideoResolution[0] / 2) - (iCrosshairDistance + iLineLength);
|
||||
vHor1[1] += (vVideoResolution[1] / 2);
|
||||
vHor2[0] += (vVideoResolution[0] / 2) + iCrosshairDistance + 1;
|
||||
vHor2[1] += (vVideoResolution[1] / 2);
|
||||
|
||||
drawfill(vVer1, [1, iLineLength], vCrossColor, 1, DRAWFLAG_ADDITIVE);
|
||||
drawfill(vVer2, [1, iLineLength], vCrossColor, 1, DRAWFLAG_ADDITIVE);
|
||||
drawfill(vHor1, [iLineLength, 1], vCrossColor, 1, DRAWFLAG_ADDITIVE);
|
||||
drawfill(vHor2, [iLineLength, 1], vCrossColor, 1, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,11 +105,11 @@ HUD_DrawSimpleCrosshair
|
|||
Draws a simple HL crosshair
|
||||
=================
|
||||
*/
|
||||
void HUD_DrawSimpleCrosshair( void )
|
||||
void HUD_DrawSimpleCrosshair(void)
|
||||
{
|
||||
static vector cross_pos;
|
||||
|
||||
// Draw the scope in the middle, seperately from the border
|
||||
cross_pos = ( vVideoResolution / 2 ) + '-12 -12';
|
||||
cross_pos = (vVideoResolution / 2) + [-12,-12];
|
||||
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [0.1875,0], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ void View_DrawViewModel( void ) {
|
|||
|
||||
pSeat->eMuzzleflash = spawn();
|
||||
pSeat->eMuzzleflash.classname = "view muzzleflash";
|
||||
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_DEPTHHACK | RF_ADDITIVE;
|
||||
pSeat->eMuzzleflash.renderflags = RF_VIEWMODEL | RF_ADDITIVE;
|
||||
}
|
||||
entity eViewModel = pSeat->eViewModel;
|
||||
entity eMuzzleflash = pSeat->eMuzzleflash;
|
||||
|
@ -229,6 +229,13 @@ void View_DrawViewModel( void ) {
|
|||
wm = sprintf("models/%s", sViewModels[ aw - 1 ]);
|
||||
}
|
||||
setmodel( eViewModel, wm );
|
||||
|
||||
if (getstati_punf(STAT_TEAM) == TEAM_CT) {
|
||||
setcustomskin(eViewModel, "", "geomset 0 2\n");
|
||||
} else {
|
||||
setcustomskin(eViewModel, "", "geomset 0 1\n");
|
||||
}
|
||||
|
||||
skel_delete( eMuzzleflash.skeletonindex );
|
||||
eMuzzleflash.skeletonindex = skel_create( eViewModel.modelindex );
|
||||
pSeat->fNumBones = skel_get_numbones( eMuzzleflash.skeletonindex ) + 1;
|
||||
|
@ -237,11 +244,6 @@ void View_DrawViewModel( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Take away alpha once it has drawn fully at least once
|
||||
if ( eMuzzleflash.alpha > 0.0f ) {
|
||||
eMuzzleflash.alpha -= ( clframetime * 45 );
|
||||
}
|
||||
|
||||
float fBaseTime = eViewModel.frame1time;
|
||||
eViewModel.frame1time += clframetime;
|
||||
eViewModel.frame2time += clframetime;
|
||||
|
@ -275,14 +277,25 @@ void View_DrawViewModel( void ) {
|
|||
if ( getstatf( STAT_VIEWZOOM ) == 1.0f ) {
|
||||
// Update muzzleflash position and draw it
|
||||
if ( eMuzzleflash.alpha > 0.0f ) {
|
||||
makevectors(getproperty(VF_ANGLES));
|
||||
eMuzzleflash.origin = gettaginfo( eViewModel, eMuzzleflash.skin );
|
||||
dynamiclight_add( pSeat->vPlayerOrigin, 400 * eMuzzleflash.alpha, '1 0.45 0');
|
||||
dynamiclight_add( pSeat->vPlayerOrigin + (v_forward * 32), 400 * eMuzzleflash.alpha, '1 0.45 0');
|
||||
addentity( eMuzzleflash );
|
||||
}
|
||||
addentity( eViewModel );
|
||||
}
|
||||
}
|
||||
|
||||
void View_PostDraw(void)
|
||||
{
|
||||
entity eMuzzleflash = pSeat->eMuzzleflash;
|
||||
|
||||
// Take away alpha once it has drawn fully at least once
|
||||
if ( eMuzzleflash.alpha > 0.0f ) {
|
||||
eMuzzleflash.alpha -= ( clframetime * 16 );
|
||||
}
|
||||
}
|
||||
|
||||
void View_Stairsmooth(void)
|
||||
{
|
||||
vector currentpos = pSeat->vPlayerOrigin;
|
||||
|
|
|
@ -88,16 +88,21 @@ int QPhysics_IsStuck( entity eTarget, vector vOffset, vector vecMins, vector vec
|
|||
void PMove_Run (void)
|
||||
void QPhysics_Run ( entity eTarget )
|
||||
{
|
||||
float flFallVel = ( eTarget.flags & FL_ONGROUND ) ? 0 : -eTarget.velocity_z;
|
||||
entity eOld = self;
|
||||
self = eTarget;
|
||||
|
||||
eTarget.maxspeed = Game_GetMaxSpeed( eTarget );
|
||||
//runstandardplayerphysics( eTarget );
|
||||
float flFallVel = ( self.flags & FL_ONGROUND ) ? 0 : -self.velocity_z;
|
||||
|
||||
self.maxspeed = Game_GetMaxSpeed( self );
|
||||
//runstandardplayerphysics(self);
|
||||
PMove_Run();
|
||||
#ifdef SSQC
|
||||
if ( ( eTarget.flags & FL_ONGROUND ) && eTarget.movetype == MOVETYPE_WALK && ( flFallVel > 580 )) {
|
||||
if ( ( self.flags & FL_ONGROUND ) && self.movetype == MOVETYPE_WALK && ( flFallVel > 580 )) {
|
||||
float fFallDamage = ( flFallVel - 580 ) * ( 100 / ( 1024 - 580 ) );
|
||||
Damage_Apply( eTarget, world, fFallDamage, eTarget.origin, FALSE );
|
||||
Damage_Apply( self, world, fFallDamage, self.origin, FALSE );
|
||||
}
|
||||
#endif
|
||||
|
||||
self = eOld;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -63,8 +63,8 @@ void vm_btnok_start(void)
|
|||
|
||||
if (res) {
|
||||
tokenizebyseparator(res, "x");
|
||||
cvar_set("vid_width", argv(0));
|
||||
cvar_set("vid_height", argv(1));
|
||||
localcmd(sprintf("vid_width %s\n", argv(0)));
|
||||
localcmd(sprintf("vid_height %s\n", argv(1)));
|
||||
localcmd("vid_restart\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,6 @@ void CListBox::Input(float type, float x, float y, float devid)
|
|||
{
|
||||
int visible;
|
||||
int pos[2];
|
||||
drawfill([g_menuofs[0] + m_x, g_menuofs[1] + m_y], [m_size[0], m_size[1]],
|
||||
[0,0,0], 1.0f);
|
||||
|
||||
visible = floor(m_size[1] / 15);
|
||||
pos[0] = m_x;
|
||||
|
|
|
@ -61,8 +61,6 @@ void CServerList::Input(float type, float x, float y, float devid)
|
|||
{
|
||||
int visible;
|
||||
int pos[2];
|
||||
drawfill([g_menuofs[0] + m_x, g_menuofs[1] + m_y], [m_size[0], m_size[1]],
|
||||
[0,0,0], 1.0f);
|
||||
|
||||
visible = floor(m_size[1] / 15);
|
||||
pos[0] = m_x;
|
||||
|
|
|
@ -58,6 +58,7 @@ float Player_SendEntity( entity ePEnt, float fChanged ) {
|
|||
WriteByte( MSG_ENTITY, self.weapon );
|
||||
WriteByte( MSG_ENTITY, self.health );
|
||||
WriteFloat( MSG_ENTITY, self.movetype );
|
||||
WriteFloat( MSG_ENTITY, self.view_ofs[2] );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,9 @@ void hostage_entity::Physics(void)
|
|||
if (trace_ent.classname == "hostage_entity") {
|
||||
hostage_entity que = (hostage_entity)trace_ent;
|
||||
if (que.m_eRescuer == m_eUser) {
|
||||
m_eRescuer = trace_ent;
|
||||
if (trace_ent != this) {
|
||||
m_eRescuer = trace_ent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,15 @@ void PMove_Init(void) {
|
|||
localcmd("serverinfo phy_maxspeed 240\n");
|
||||
}
|
||||
|
||||
int PMove_Contents(vector org)
|
||||
{
|
||||
int oldhitcontents = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = -1;
|
||||
traceline(org, org, TRUE, self);
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
return trace_endcontentsi;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
PMove_Categorize
|
||||
|
@ -50,10 +59,7 @@ PMove_Categorize
|
|||
*/
|
||||
void PMove_Categorize(void)
|
||||
{
|
||||
float contents;
|
||||
|
||||
// Make sure
|
||||
if ((self.flags & FL_CROUCHING) /*&& !(self.flags & FL_ONLADDER)*/) {
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
self.mins = VEC_CHULL_MIN;
|
||||
self.maxs = VEC_CHULL_MAX;
|
||||
self.view_ofs = VEC_PLAYER_CVIEWPOS;
|
||||
|
@ -62,8 +68,8 @@ void PMove_Categorize(void)
|
|||
self.maxs = VEC_HULL_MAX;
|
||||
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
}
|
||||
|
||||
tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 0.25', FALSE, self);
|
||||
|
||||
tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 0.25', TRUE, self);
|
||||
|
||||
if (!trace_startsolid) {
|
||||
if ((trace_fraction < 1) && (trace_plane_normal[2] > 0.7)) {
|
||||
|
@ -73,28 +79,10 @@ void PMove_Categorize(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*// Check water levels, boo */
|
||||
int oldhitcontents = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = CONTENTBIT_LAVA | CONTENTBIT_SLIME | CONTENTBIT_WATER;
|
||||
tracebox( self.origin, self.mins, self.maxs, self.origin, FALSE, self );
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
//print(sprintf( "Contents: %i\n", trace_endcontentsi));
|
||||
|
||||
if (trace_endcontentsi & CONTENTBIT_WATER) {
|
||||
contents = CONTENT_WATER;
|
||||
} else if (trace_endcontentsi & CONTENTBIT_SLIME) {
|
||||
contents = CONTENT_SLIME;
|
||||
} else if (trace_endcontentsi & CONTENTBIT_LAVA) {
|
||||
contents = CONTENT_LAVA;
|
||||
} else {
|
||||
contents = CONTENT_EMPTY;
|
||||
}
|
||||
|
||||
if (contents < CONTENT_SOLID && contents != CONTENT_LADDER) {
|
||||
self.watertype = contents;
|
||||
if (pointcontents(self.origin + (self.mins + self.maxs) * 0.5) < CONTENT_SOLID) {
|
||||
if (pointcontents(self.origin + self.maxs - '0 0 1') < CONTENT_SOLID) {
|
||||
if (PMove_Contents(self.origin + self.mins + [0,0,1]) == 32) {
|
||||
self.watertype = CONTENT_WATER;
|
||||
if (PMove_Contents(self.origin + (self.mins + self.maxs) * 0.5) == 32) {
|
||||
if (PMove_Contents(self.origin + self.maxs - '0 0 1') == 32) {
|
||||
self.waterlevel = 3;
|
||||
} else {
|
||||
self.waterlevel = 2;
|
||||
|
@ -150,7 +138,7 @@ void PMove_WaterMove(void)
|
|||
#if 0
|
||||
//sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
self.flags = self.flags - (self.flags & FL_INWATER);
|
||||
self.flags &= ~FL_INWATER;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -250,7 +238,7 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
|
||||
if (self.movetype == MOVETYPE_WALK) {
|
||||
// Crouching
|
||||
if (input_buttons & INPUT_BUTTON8 /*&& !(self.flags & FL_ONLADDER)*/) {
|
||||
if (input_buttons & INPUT_BUTTON8) {
|
||||
self.flags |= FL_CROUCHING;
|
||||
} else {
|
||||
// If we aren't holding down duck anymore and 'attempt' to stand up, prevent it
|
||||
|
@ -263,13 +251,15 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
self.flags &= ~FL_CROUCHING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
setsize(self, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
//input_movevalues *= 0.333f;
|
||||
#ifdef SSQC
|
||||
self.view_ofs = VEC_PLAYER_CVIEWPOS;
|
||||
#endif
|
||||
#ifdef CSQC
|
||||
print("CSQC crouching!\n");
|
||||
#else
|
||||
print("SSQC crouching!\n");
|
||||
#endif
|
||||
} else {
|
||||
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
if (iFixCrouch && QPMove_IsStuck(self, [0,0,0], VEC_HULL_MIN, VEC_HULL_MAX)) {
|
||||
|
@ -281,20 +271,31 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
}
|
||||
}
|
||||
setorigin(self, self.origin);
|
||||
#ifdef SSQC
|
||||
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
#endif
|
||||
#ifdef CSQC
|
||||
print("CSQC standing!\n");
|
||||
#else
|
||||
print("SSQC standing!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
makevectors(input_angles);
|
||||
makevectors(input_angles);
|
||||
|
||||
// swim
|
||||
if (self.waterlevel >= 2) {
|
||||
if (self.movetype != MOVETYPE_NOCLIP) {
|
||||
self.flags = self.flags - (self.flags & FL_ONGROUND);
|
||||
|
||||
#ifdef SSQC
|
||||
//print("SSQC: Water.\n");
|
||||
#else
|
||||
//print("CSQC: Water.\n");
|
||||
#endif
|
||||
|
||||
self.flags &= ~FL_ONGROUND;
|
||||
|
||||
if (input_movevalues == [0,0,0]) {
|
||||
vecWishVel = '0 0 -60'; // drift towards bottom
|
||||
vecWishVel = [0,0,-60]; // drift towards bottom
|
||||
} else {
|
||||
vecWishVel = v_forward * input_movevalues[0];
|
||||
vecWishVel += v_right * input_movevalues[1];
|
||||
|
@ -302,13 +303,13 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
}
|
||||
|
||||
flWishSpeed = vlen(vecWishVel);
|
||||
|
||||
|
||||
if (flWishSpeed > self.maxspeed) {
|
||||
flWishSpeed = self.maxspeed;
|
||||
}
|
||||
|
||||
|
||||
flWishSpeed = flWishSpeed * 0.7;
|
||||
|
||||
|
||||
// water friction
|
||||
if (self.velocity != [0,0,0]) {
|
||||
flFriction = vlen(self.velocity) * (1 - flMovetime * serverkeyfloat("phy_friction"));
|
||||
|
@ -320,17 +321,24 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
} else {
|
||||
flFriction = 0;
|
||||
}
|
||||
|
||||
|
||||
// water acceleration
|
||||
if (flWishSpeed <= flFriction) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
flFriction = min(flWishSpeed - flFriction, serverkeyfloat("phy_accelerate") * flWishSpeed * flMovetime);
|
||||
self.velocity = self.velocity + normalize(vecWishVel) * flFriction;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
//print("SSQC: Outside.\n");
|
||||
#else
|
||||
//print("CSQC: Outside.\n");
|
||||
#endif
|
||||
|
||||
// hack to not let you back into teleporter
|
||||
if (self.teleport_time > 0 && input_movevalues[0] < 0) {
|
||||
vecWishVel = v_right * input_movevalues[1];
|
||||
|
@ -348,7 +356,7 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
} else {
|
||||
vecWishVel[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
vecWishDir = normalize(vecWishVel);
|
||||
flWishSpeed = vlen(vecWishVel);
|
||||
|
||||
|
@ -397,7 +405,7 @@ void PMove_Run_Acceleration(float flMovetime, float flBefore)
|
|||
self.flags |= FL_JUMPRELEASED;
|
||||
}
|
||||
|
||||
if (self.flags & FL_ONGROUND /*|| self.flags & FL_ONLADDER*/) {
|
||||
if (self.flags & FL_ONGROUND) {
|
||||
// friction
|
||||
if (self.velocity[0] || self.velocity[1]) {
|
||||
vecTemp = self.velocity;
|
||||
|
@ -662,7 +670,7 @@ void PMove_Run(void)
|
|||
if (self.waterlevel >= 2) {
|
||||
PMove_CheckWaterJump();
|
||||
}
|
||||
|
||||
|
||||
if (input_buttons & INPUT_BUTTON2) {
|
||||
input_movevalues[2] = 240;
|
||||
}
|
||||
|
@ -670,18 +678,12 @@ void PMove_Run(void)
|
|||
input_movevalues[2] = -240;
|
||||
}
|
||||
|
||||
self.dimension_solid = 255;
|
||||
self.dimension_hit = 255;
|
||||
|
||||
/* Call accelerate before and after the actual move,
|
||||
* with half the move each time.
|
||||
* This reduces framerate dependance. */
|
||||
PMove_Run_Acceleration(input_timelength / 2, TRUE);
|
||||
PMove_Run_Move();
|
||||
PMove_Run_Acceleration(input_timelength / 2, FALSE);
|
||||
|
||||
self.dimension_solid = 254;
|
||||
self.dimension_hit = 254;
|
||||
|
||||
/* NOTE: should clip to network precision here if lower than a float */
|
||||
self.angles = input_angles;
|
||||
|
|
|
@ -69,12 +69,12 @@ void ambient_generic::Respawn(void)
|
|||
m_iToggleSwitch = FALSE;
|
||||
} else {
|
||||
m_iToggleSwitch = TRUE;
|
||||
UseNormal();
|
||||
}
|
||||
|
||||
if (m_iLoop) {
|
||||
Trigger = UseLoop;
|
||||
}
|
||||
UseNormal();
|
||||
}
|
||||
|
||||
void ambient_generic::ambient_generic (void)
|
||||
|
|
|
@ -354,8 +354,9 @@ void func_door::func_door(void)
|
|||
|
||||
void func_water(void)
|
||||
{
|
||||
spawnfunc_func_door();
|
||||
setmodel(self, self.model);
|
||||
self.classname = "func_water";
|
||||
self.solid = SOLID_BSP;
|
||||
self.skin = CONTENT_WATER;
|
||||
setorigin(self, self.origin); // relink. have to do this.
|
||||
}
|
||||
|
|
|
@ -6,189 +6,102 @@
|
|||
*
|
||||
****/
|
||||
|
||||
/*class CPathCorner
|
||||
class path_corner:CBaseTrigger
|
||||
{
|
||||
float m_flSpeed;
|
||||
float m_flWait;
|
||||
string m_strTarget;
|
||||
void() CPathCorner;
|
||||
|
||||
void() path_corner;
|
||||
};
|
||||
|
||||
void CPathCorner :: CPathCorner ( void )
|
||||
void path_corner::path_corner(void)
|
||||
{
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
m_flSpeed = 100;
|
||||
m_flWait = 1.0f;
|
||||
}
|
||||
|
||||
CLASSEXPORT(path_corner, CPathCorner)
|
||||
|
||||
class CFuncTrain
|
||||
class func_train:CBaseTrigger
|
||||
{
|
||||
int m_iDamage;
|
||||
float m_flNextBlockAttack;
|
||||
float m_flTraveltime;
|
||||
float m_flWait;
|
||||
float m_flSpeed;
|
||||
vector m_vecDestination;
|
||||
vector m_vecDestDelta;
|
||||
|
||||
// We don't need to inherit CBaseTrigger for these yet
|
||||
string m_strTarget;
|
||||
entity m_eTarget;
|
||||
|
||||
void() CFuncTrain;
|
||||
virtual void() Move;
|
||||
virtual void() Blocked;
|
||||
virtual void() Trigger;
|
||||
void() func_train;
|
||||
virtual void() Find;
|
||||
virtual void() MoveEnd;
|
||||
virtual void() Trigger;
|
||||
virtual void() Wait;
|
||||
virtual void() Next;
|
||||
virtual void() m_pMove = 0;
|
||||
};
|
||||
|
||||
void CFuncTrain :: Done ( void )
|
||||
void func_train::Find(void)
|
||||
{
|
||||
setorigin( this, m_vecDestination );
|
||||
velocity = '0 0 0';
|
||||
nextthink = -1;
|
||||
entity f = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
|
||||
|
||||
if ( m_pMove ) {
|
||||
m_pMove();
|
||||
}
|
||||
}
|
||||
|
||||
void CFuncTrain :: Blocked ( void )
|
||||
{
|
||||
if ( time < m_flNextBlockAttack ) {
|
||||
if (!f) {
|
||||
remove(this);
|
||||
return;
|
||||
}
|
||||
m_flNextBlockAttack = time + 0.5;
|
||||
//other.deathtype = "squish";
|
||||
//T_Damage (other, self, self, m_iDamage);
|
||||
|
||||
print("^2func_train^7: Successfully found first target.\n");
|
||||
|
||||
vector vecWorldPos;
|
||||
vecWorldPos[0] = absmin[0] + ( 0.5 * ( absmax[0] - absmin[0] ) );
|
||||
vecWorldPos[1] = absmin[1] + ( 0.5 * ( absmax[1] - absmin[1] ) );
|
||||
vecWorldPos[2] = absmin[2] + ( 0.5 * ( absmax[2] - absmin[2] ) );
|
||||
|
||||
vecWorldPos = f.origin - vecWorldPos;
|
||||
setorigin(this, vecWorldPos);
|
||||
}
|
||||
|
||||
void CFuncTrain :: Trigger ( void )
|
||||
void func_train::MoveEnd(void)
|
||||
{
|
||||
// already activated
|
||||
if ( think != Find ) {
|
||||
return;
|
||||
}
|
||||
Next();
|
||||
entity f = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
|
||||
CBaseTrigger p = (CBaseTrigger)f;
|
||||
m_strTarget = p.m_strTargetName;
|
||||
|
||||
velocity = [0,0,0];
|
||||
}
|
||||
|
||||
void CFuncTrain :: Wait ( void )
|
||||
void func_train::Trigger(void)
|
||||
{
|
||||
if ( m_flWait ) {
|
||||
nextthink = ltime + m_flWait;
|
||||
sound (self, CHAN_VOICE, noise, 1, ATTN_NORM);
|
||||
} else {
|
||||
nextthink = ltime + 0.1f;
|
||||
}
|
||||
entity f = find(world, CBaseTrigger::m_strTargetName, m_strTarget);
|
||||
|
||||
think = Next;
|
||||
}
|
||||
|
||||
void CFuncTrain :: Next ( void )
|
||||
{
|
||||
float flLen;
|
||||
CPathCorner pTarget;
|
||||
|
||||
m_eTarget = find( world, ::targetname, m_strTarget );
|
||||
pTarget = (CPathCorner) m_eTarget;
|
||||
m_strTarget = pTarget.m_strTarget;
|
||||
|
||||
if ( !m_strTarget ) {
|
||||
objerror( "train_next: no next target" );
|
||||
}
|
||||
|
||||
if ( pTarget.m_flWait ) {
|
||||
m_flWait = pTarget.m_flWait;
|
||||
} else {
|
||||
m_flWait = 0;
|
||||
}
|
||||
vector vecWorldPos;
|
||||
vecWorldPos[0] = absmin[0] + ( 0.5 * ( absmax[0] - absmin[0] ) );
|
||||
vecWorldPos[1] = absmin[1] + ( 0.5 * ( absmax[1] - absmin[1] ) );
|
||||
vecWorldPos[2] = absmin[2] + ( 0.5 * ( absmax[2] - absmin[2] ) );
|
||||
|
||||
sound( self, CHAN_VOICE, noise1, 1, ATTN_NORM );
|
||||
|
||||
m_vecDestination = pTarget.origin - mins;
|
||||
m_flSpeed = pTarget.m_flSpeed;
|
||||
m_pMove = Wait;
|
||||
think = Done;
|
||||
vector vecDifference = (f.origin - vecWorldPos);
|
||||
float flTravel = vlen(vecDifference);
|
||||
float flTravelTime = (flTravel / m_flSpeed);
|
||||
|
||||
if ( m_vecDestination == origin ) {
|
||||
velocity = '0 0 0';
|
||||
nextthink = ltime + 0.1;
|
||||
return;
|
||||
}
|
||||
|
||||
// set destdelta to the vector needed to move
|
||||
m_vecDestDelta = m_vecDestination - origin;
|
||||
flLen = vlen( m_vecDestDelta ); // calculate length of vector
|
||||
m_flTraveltime = flLen / m_flSpeed; // divide by speed to get time to reach dest
|
||||
|
||||
if ( m_flTraveltime < 0.1 ) {
|
||||
velocity = '0 0 0';
|
||||
nextthink = ltime + 0.1;
|
||||
return;
|
||||
}
|
||||
|
||||
nextthink = ltime + m_flTraveltime; // set nextthink to trigger a think when dest is reached
|
||||
velocity = m_vecDestDelta * ( 1 / m_flTraveltime ); // scale the destdelta vector by the time spent traveling to get velocity
|
||||
think = MoveEnd;
|
||||
nextthink = (time + flTravelTime);
|
||||
velocity = (vecDifference * (1 / flTravelTime));
|
||||
}
|
||||
|
||||
void CFuncTrain :: Find ( void )
|
||||
void func_train::func_train(void)
|
||||
{
|
||||
CPathCorner pTarget;
|
||||
m_eTarget = find(world, ::targetname, m_strTarget);
|
||||
pTarget = (CPathCorner) m_eTarget;
|
||||
m_strTarget = pTarget.m_strTarget;
|
||||
setorigin (this, m_eTarget.origin - mins);
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
|
||||
// not triggered, so start immediately
|
||||
if ( !targetname ) {
|
||||
nextthink = ltime + 0.1;
|
||||
think = Next;
|
||||
}
|
||||
}
|
||||
|
||||
void CFuncTrain :: CFuncTrain ( void )
|
||||
{
|
||||
if ( !m_flSpeed ) {
|
||||
m_flSpeed = 100;
|
||||
}
|
||||
if ( !m_strTarget ) {
|
||||
objerror ("func_train without a target");
|
||||
}
|
||||
if ( !m_iDamage ) {
|
||||
m_iDamage = 2;
|
||||
}
|
||||
|
||||
if ( sounds == 0 ) {
|
||||
noise = ("misc/null.wav");
|
||||
precache_sound ("misc/null.wav");
|
||||
noise1 = ("misc/null.wav");
|
||||
precache_sound ("misc/null.wav");
|
||||
}
|
||||
|
||||
if ( sounds == 1 ) {
|
||||
noise = ("plats/train2.wav");
|
||||
precache_sound ("plats/train2.wav");
|
||||
noise1 = ("plats/train1.wav");
|
||||
precache_sound ("plats/train1.wav");
|
||||
for ( int i = 1; i < ( tokenize( __fullspawndata ) - 1 ); i += 2 ) {
|
||||
switch ( argv( i ) ) {
|
||||
case "speed":
|
||||
m_flSpeed = stof(argv(i+1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
solid = SOLID_BSP;
|
||||
movetype = MOVETYPE_PUSH;
|
||||
blocked = Blocked;
|
||||
//blocked = Blocked;
|
||||
|
||||
setmodel( this, model );
|
||||
setsize( this, mins , maxs );
|
||||
setorigin( this, origin );
|
||||
setmodel(this, m_oldModel);
|
||||
setsize(this, mins, maxs);
|
||||
setorigin(this, m_oldOrigin);
|
||||
|
||||
// start trains on the second frame, to make sure their targets have had
|
||||
// a chance to spawn
|
||||
nextthink = ltime + 0.1;
|
||||
nextthink = time + 0.25f;
|
||||
think = Find;
|
||||
}
|
||||
|
||||
CLASSEXPORT(func_train, CFuncTrain)*/
|
||||
|
|
|
@ -27,4 +27,3 @@ void func_wall :: Trigger ( void )
|
|||
frame = 1 - frame;
|
||||
}
|
||||
|
||||
CLASSEXPORT( func_train, func_wall )
|
||||
|
|
|
@ -44,10 +44,15 @@ void infodecal(void)
|
|||
self.texture = sprintf( "materials/%s", self.texture );
|
||||
}
|
||||
|
||||
self.texture = "";
|
||||
if (!self.texture) {
|
||||
remove(self);
|
||||
return;
|
||||
}
|
||||
|
||||
/*self.origin[0] = rint(self.origin[0]);
|
||||
self.origin[1] = rint(self.origin[1]);
|
||||
self.origin[2] = rint(self.origin[2]);*/
|
||||
|
||||
/* Unrolled because I'm lazy */
|
||||
makevectors([0, 0, 0]);
|
||||
|
|
|
@ -42,7 +42,7 @@ void trigger_changelevel :: Change ( void )
|
|||
{
|
||||
if ( m_strLandmark ) {
|
||||
entity landmark = find( world, ::targetname, m_strLandmark );
|
||||
g_landmarkpos = landmark.origin - m_activator.origin;
|
||||
g_landmarkpos = m_activator.origin - landmark.origin;
|
||||
changelevel( m_strMap, m_strLandmark );
|
||||
} else {
|
||||
changelevel( m_strMap );
|
||||
|
|
|
@ -26,6 +26,10 @@ class trigger_multiple : CBaseTrigger
|
|||
void trigger_multiple :: touch ( void )
|
||||
{
|
||||
eActivator = other;
|
||||
|
||||
if (other.movetype != MOVETYPE_WALK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_flDelay > 0 ) {
|
||||
CBaseTrigger::UseTargets_Delay( m_flDelay );
|
||||
|
|
Binary file not shown.
BIN
freecs/menu.dat
BIN
freecs/menu.dat
Binary file not shown.
BIN
freecs/progs.dat
BIN
freecs/progs.dat
Binary file not shown.
Loading…
Reference in a new issue