Quake3World.com Forums
     Programming Discussion
        Locking player's viewangles


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Locking player's viewangles

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 09-15-2011 03:08 AM           Profile   Send private message  E-mail  Edit post Reply with quote


I'm having a bit of an odd problem. I implemented cutscenes in my EntityPlus mod and while this works well, the only problem is that if the player moves the mouse during the cutscene (or presses the view up/down/left/right buttons) the view of the player after the cutscene will be affected by the mouse movement/button presses.

I want the player to be unable to alter its own view angles during the cutscene so that the view after the cutscene has ended is identical to the view before the cutscene. Locking player movement works already, it's just the view angles that won't seem to stick.

Anyone know how I can achieve this? Current source can be found here.

I already have this bit of code in PM_UpdateViewAngles in bg_pmove.c, but it doesn't seem to help anything:

Code:
if ( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION || ps->pm_type == PM_CUTSCENE ) {
   return;         // no view changes at all
}


During a cutscene, the player's pm_type is set to PM_CUTSCENE. This is how I tell if a player is currently in a cutscene or not.

I've also tried storing the player's viewangles in a temporary variable when the cutscene starts and then restore that when the cutscene has finished playing. This is done serverside (in the game project):

Code:
VectorCopy(self->activator->orgAngles, self->activator->client->ps.viewangles);


But this doesn't seem to help either.

Anyone know how I can stop the player from giving input that changes the view angles?




Top
                 

Insane Quaker
Insane Quaker
Joined: 05 Mar 2010
Posts: 384
PostPosted: 09-15-2011 05:39 AM           Profile Send private message  E-mail  Edit post Reply with quote


I think what you want is...

pm->xyspeed = 0;

... although I haven't tested it myself. I just got that from scratching around in the Smoking Guns source for the duel camera intro in g_active.c

Edit:
Nevermind, this looks more relevant:

bg_public.h:
Code:
#define SF_DU_INTRO      0x00020   // player is in intro mode, don't update the viewangles


bg_pmove.c (PM_UpdateViewAngles):
Code:
   // if in duel intro mode, don't update viewangles
   if (ps->stats[STAT_FLAGS] & SF_DU_INTRO){

      // set the delta angle
      for (i=0 ; i<3 ; i++) {
         int      cmdAngle;

         cmdAngle = ANGLE2SHORT(pm->ps->viewangles[i]);
         pm->ps->delta_angles[i] = cmdAngle - pm->cmd.angles[i];
      }
      return;
   }


g_active.c (ClientThink_real):
Code:
   // mouseangles can't be moved during camera move
   if(!du_nextroundstart && du_introend - DU_INTRO_DRAW >= level.time &&
      ent->client->sess.sessionTeam == TEAM_FREE) {
      pm.ps->stats[STAT_FLAGS] |= SF_DU_INTRO;
   } else {
      pm.ps->stats[STAT_FLAGS] &= ~SF_DU_INTRO;
   }


Which you'd obviously alter appropriately. You can get the source at http://sourceforge.net/projects/smokinguns/




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 09-15-2011 06:50 AM           Profile   Send private message  E-mail  Edit post Reply with quote


That bg_pmove.c code is exactly what I needed. Thanks a lot, it works perfectly!




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.