From f6627362a378c7e8e626915480c47dac65c0f0b9 Mon Sep 17 00:00:00 2001 From: erysdren Date: Tue, 9 Jul 2024 19:53:29 -0500 Subject: [PATCH] Normalize lookup/lookdown between resolutions --- rott/_rt_play.h | 3 +- rott/rt_playr.c | 125 ++---------------------------------------------- rott/winrott.c | 7 ++- 3 files changed, 8 insertions(+), 127 deletions(-) diff --git a/rott/_rt_play.h b/rott/_rt_play.h index 8c61f0b..0f6f8c2 100644 --- a/rott/_rt_play.h +++ b/rott/_rt_play.h @@ -22,12 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "rt_fixed.h" -#define YZANGLELIMIT (30*FINEANGLES/360) #define YZTILTSPEED 20 #define SNAPBACKSPEED 10 #define YZHORIZONSPEED 4 #define HORIZONYZOFFSET (FINEANGLES/4) +extern int YZANGLELIMIT; + #define SetPlayerHorizon(ps,hlevel) \ { \ if ((hlevel)>YZANGLELIMIT) \ diff --git a/rott/rt_playr.c b/rott/rt_playr.c index f3c051d..4aa7896 100644 --- a/rott/rt_playr.c +++ b/rott/rt_playr.c @@ -96,6 +96,7 @@ static const int SHROOMYZANGLE = (15*FINEANGLES/360); static const int FALLINGYZANGLE = -(15*FINEANGLES/360); static const int NORMALYZANGLE = 0; +int YZANGLELIMIT = (30*FINEANGLES/360); /* ============================================================================= @@ -236,7 +237,6 @@ void CheckWeaponChange (objtype * ob); void PlayerMissileAttack(objtype* ); void Cmd_Use(objtype*); //void ComError (char *error, ...); -int FinddTopYZANGLELIMITvalue(objtype *ob); statetype s_free = {false,0,0,T_Free,0,&s_free}; statetype s_inelevator = {false,0,420,T_Player,0,&s_player}; @@ -3728,8 +3728,6 @@ void SetNormalHorizon (objtype * ob) = =================== */ -extern int iG_playerTilt; -extern double dTopYZANGLELIMIT; void PlayerTiltHead (objtype * ob) { playertype * pstate; @@ -3865,133 +3863,16 @@ void PlayerTiltHead (objtype * ob) if ((abs(yzangle-pstate->horizon))horizon; } -//SetTextMode(); - - if (yzangle != 512){ - FinddTopYZANGLELIMITvalue(ob); - } - yzangle+=dyz; if (yzangle-HORIZONYZOFFSET>YZANGLELIMIT) yzangle=HORIZONYZOFFSET+YZANGLELIMIT; -/* else if (yzangle-HORIZONYZOFFSET<-TopYZANGLELIMIT)//bnafix - yzangle=HORIZONYZOFFSET-TopYZANGLELIMIT;//bnafix -dTopYZANGLELIMIT*/ - else if (yzangle-HORIZONYZOFFSET<-dTopYZANGLELIMIT)//bnafix - yzangle=HORIZONYZOFFSET-dTopYZANGLELIMIT;//bnafix + else if (yzangle-HORIZONYZOFFSET<-YZANGLELIMIT) + yzangle=HORIZONYZOFFSET-YZANGLELIMIT; ob->yzangle=yzangle-HORIZONYZOFFSET; Fix(ob->yzangle); - - iG_playerTilt = ob->yzangle; - } -//---------------------------------------------------------------------- -// bna added function -// if a player is to close to wall, looking down max -//,this func limit the dTopYZANGLELIMIT value when -// facing a wall -#define SMALLANGLE 90 -//there is small angles where didnt work -//so we check for them to = 90/2048 = aprox, 15 degrees -int FinddTopYZANGLELIMITvalue(objtype *ob) -{/* - - -checkx = ob->tilex + 1; -checky = ob->tiley + 1; -if (actorat[checkx][checky]){ - return 0; -} -return 1; - -checkx = ob->tilex ; -checky = ob->tiley; - -// find which direction the player is facing -//and check if it is a wall - -*/ - - //use lowest down angle - dTopYZANGLELIMIT = (26*FINEANGLES/360); - - if (ob->angle < 256 || ob->angle > 1792) { - if ((tilemap[ob->tilex + 1][ob->tiley])!=0){ - - return 0; - } - //ob->dir = east; - }else if (ob->angle < 768) { - if ((tilemap[ob->tilex][ob->tiley-1])!=0){ - return 0; - } - }else if (ob->angle < 1280) { - if ((tilemap[ob->tilex-1][ob->tiley])!=0){ - return 0; - } - }else{ - if ((tilemap[ob->tilex][ob->tiley+1])!=0){ - return 0; - } - } - - - //use middle down angle - dTopYZANGLELIMIT = (42*FINEANGLES/360); - - if ((ob->angle > 768-SMALLANGLE)&&(ob->angle <= 768)) { - if ((tilemap[ob->tilex -1][ob->tiley])!=0){//ob->tiley-1 - return 0; - } - } - if ((ob->angle < 1280+SMALLANGLE)&&(ob->angle >= 1280)) { - if ((tilemap[ob->tilex - 1][ob->tiley])!=0){//ob->tiley+1 - return 0; - } - } - if ((ob->angle > 256)&&(ob->angle <= 256+SMALLANGLE)) { - if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley-1 - return 0; - } - } - if ((ob->angle < 1792)&&(ob->angle >= 1792-SMALLANGLE)) { - if ((tilemap[ob->tilex + 1][ob->tiley])!=0){//ob->tiley+1 - return 0; - } - } - if ((ob->angle < 1280)&&(ob->angle >= 1280-SMALLANGLE)) { - if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tilex-1 - return 0; - } - } - if ((ob->angle > 1792)&&(ob->angle <= 1792+SMALLANGLE)) { - if ((tilemap[ob->tilex ][ob->tiley+1])!=0){//ob->tiley+1 - return 0; - } - } - if ((ob->angle > 768)&&(ob->angle <= 768+SMALLANGLE)) { - if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1 - return 0; - } - } - if ((ob->angle < 256)&&(ob->angle >= 256-SMALLANGLE)) { - if ((tilemap[ob->tilex][ob->tiley-1])!=0){//ob->tiley-1 - return 0; - } - } - - //use max down angle - dTopYZANGLELIMIT = (90*FINEANGLES/360); - return 1; -} -// bna added function end -//---------------------------------------------------------------------- - - - - /* =================== = diff --git a/rott/winrott.c b/rott/winrott.c index 65cea6f..d790fae 100644 --- a/rott/winrott.c +++ b/rott/winrott.c @@ -19,8 +19,6 @@ int iGLOBAL_AMMO_Y; int iGLOBAL_FOCALWIDTH; double dGLOBAL_FPFOCALWIDTH; -double dTopYZANGLELIMIT; - int iG_X_center; int iG_Y_center; @@ -31,6 +29,7 @@ extern int viewwidth; //---------------------------------------------------------------------- #define FINEANGLES 2048 +extern int YZANGLELIMIT; void SetRottScreenRes (int Width, int Height) { @@ -49,7 +48,7 @@ void SetRottScreenRes (int Width, int Height) iGLOBAL_AMMO_X = 300; iGLOBAL_AMMO_Y = 184; - dTopYZANGLELIMIT = (44*FINEANGLES/360);; + YZANGLELIMIT = (30*FINEANGLES/360); } if (iGLOBAL_SCREENWIDTH == 640) { iGLOBAL_FOCALWIDTH = 180; @@ -59,7 +58,7 @@ void SetRottScreenRes (int Width, int Height) iGLOBAL_AMMO_X = 600;//300*2; iGLOBAL_AMMO_Y = 464;//480-16; - dTopYZANGLELIMIT = (42*FINEANGLES/360);; + YZANGLELIMIT = (60*FINEANGLES/360); } }