void RenderViewport::SetupFreelook() { double dy; if (viewpoint.camera != NULL) { dy = FocalLengthY * (-viewpoint.Angles.Pitch).Tan(); } else { dy = 0; } CenterY = (viewheight / 2.0) + dy; viewwindow.centery = xs_ToInt(CenterY); globaluclip = -CenterY / InvZtoScale; globaldclip = (viewheight - CenterY) / InvZtoScale; }
void ControlMovement (AActor *ob) { if(playstate == ex_died) return; int32_t oldx,oldy; angle_t angle; int strafe = controlstrafe; thrustspeed = 0; oldx = players[0].mo->x; oldy = players[0].mo->y; // // side to side move // if (buttonstate[bt_strafe]) { // // strafing // // strafe += controlx; } else { if(players[0].ReadyWeapon && players[0].ReadyWeapon->fovscale > 0) controlx = xs_ToInt(controlx*players[0].ReadyWeapon->fovscale); // // not strafing // ob->angle -= controlx*(ANGLE_1/ANGLESCALE); } if(strafe) { // Cap the speed if (strafe > 100) strafe = 100; else if (strafe < -100) strafe = -100; strafe = FixedMul(players[0].mo->speed<<7, FixedMul(strafe, players[0].mo->sidemove[abs(strafe) >= RUNMOVE])); if (strafe > 0) { angle = ob->angle - ANGLE_90; Thrust (angle,strafe*MOVESCALE); // move to left } else if (strafe < 0) { angle = ob->angle + ANGLE_90; Thrust (angle,-strafe*MOVESCALE); // move to right } } // // forward/backwards move // if (controly < 0) { if(controly < -100) controly = -100; controly = FixedMul(players[0].mo->speed<<7, FixedMul(controly, players[0].mo->forwardmove[controly <= -RUNMOVE])); Thrust (ob->angle,-controly*MOVESCALE); // move forwards } else if (controly > 0) { if(controly > 100) controly = 100; controly = FixedMul(players[0].mo->speed<<7, FixedMul(controly, players[0].mo->forwardmove[controly >= RUNMOVE])); angle = ob->angle + ANGLE_180; Thrust (angle,controly*MOVESCALE*2/3); // move backwards } if (gamestate.victoryflag) // watching the BJ actor return; }