Menu

Creating a viewpos command

Gman
2017-08-20
2017-08-20
  • Gman

    Gman - 2017-08-20

    I modified the viewpos from Quake 2 to work in UHexen2.

    file: cmd.c
    //add just before cmd_Init near the end
    void V_Viewpos_f(void)
    {
    Con_Printf("(%i %i %i) : %i\n", (int)sv_player->v.origin[0],
    (int)sv_player->v.origin[1], (int)sv_player->v.origin[2],
    (int)sv_player->v.v_angle[YAW]);
    }

    //then add this line within cmd_init
    Cmd_AddCommand("viewpos", V_Viewpos_f);

    Works great, shows you x,y,z,yaw in the console so you know where you are and what direction you're facing. idmypos 1 like in GZDoom would be nice as well, if you want constant updates on position, but this will do for indicating object location for walkthroughs.

     
  • Gman

    Gman - 2017-08-20

    The ability to look almost straight up and down was easy enough. Just change the 80 and -70 values to 89 and -89.

    files cl_input.c & in_win.c

    if (cl.viewangles[PITCH] > 80)

    cl.viewangles[PITCH] = 80;
    

    if (cl.viewangles[PITCH] < -70)

    cl.viewangles[PITCH] = -70;
    

    Ports like Darkplaces have variables such as in_pitch_min and in_pitch_max, though I personally don't know why one would want to limit the view range.

     

    Last edit: Gman 2017-08-20
  • Ozkan Sezer

    Ozkan Sezer - 2017-08-21

    viewpos command implemented for v1.5.9 (taken from FitzQuake, see svn r5964)

     
  • Gman

    Gman - 2017-08-21

    Awesome, thanks! This will be helpful in identifying locations. I suppose sv_player is only accessible from the server. When playing single player the client also recieves server messages. sv_player might not work correctly with coop multiplayer.

    cl_minpitch and cl_maxpitch would be nice to have as well, with defaults of -70 and +80. Not sure why Quake1/Hexen2 had those hardcoded, perhaps they were worried people might get confused at extreme pitches, not sure what yaw direction they were facing? Went away with Quake2/Quake3 with 89deg up and down.

     

Log in to post a comment.