mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
SW: Minor repairs for Q16.16 implementation.
This commit is contained in:
parent
1ecc74c2ec
commit
d78d046bad
3 changed files with 21 additions and 23 deletions
|
@ -1141,7 +1141,7 @@ ViewOutsidePlayerRecurse(PLAYERp pp, int32_t* vx, int32_t* vy, int32_t* vz, int1
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BackView(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
BackView(int *nx, int *ny, int *nz, short *vsect, fix16_t *nq16ang, short horiz)
|
||||||
{
|
{
|
||||||
vec3_t n = { *nx, *ny, *nz };
|
vec3_t n = { *nx, *ny, *nz };
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
|
@ -1153,7 +1153,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
|
|
||||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||||
|
|
||||||
ang = *nang + pp->view_outside_dang;
|
ang = fix16_to_int(*nq16ang) + pp->view_outside_dang;
|
||||||
|
|
||||||
// Calculate the vector (nx,ny,nz) to shoot backwards
|
// Calculate the vector (nx,ny,nz) to shoot backwards
|
||||||
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
|
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 3);
|
||||||
|
@ -1215,7 +1215,7 @@ BackView(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
flag_backup = hsp->cstat;
|
flag_backup = hsp->cstat;
|
||||||
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
ASSERT(*vsect >= 0 && *vsect < MAXSECTORS);
|
||||||
BackView(nx, ny, nz, vsect, nang, horiz);
|
BackView(nx, ny, nz, vsect, nq16ang, horiz);
|
||||||
hsp->cstat = flag_backup;
|
hsp->cstat = flag_backup;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1256,11 +1256,11 @@ BackView(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
// Make sure vsect is correct
|
// Make sure vsect is correct
|
||||||
updatesectorz(*nx, *ny, *nz, vsect);
|
updatesectorz(*nx, *ny, *nz, vsect);
|
||||||
|
|
||||||
*nang = ang;
|
*nq16ang = fix16_from_int(ang);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nq16ang, short horiz)
|
||||||
{
|
{
|
||||||
vec3_t n = { *nx, *ny, *nz };
|
vec3_t n = { *nx, *ny, *nz };
|
||||||
SPRITEp sp;
|
SPRITEp sp;
|
||||||
|
@ -1270,7 +1270,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
PLAYERp pp = &Player[screenpeek];
|
PLAYERp pp = &Player[screenpeek];
|
||||||
short ang;
|
short ang;
|
||||||
|
|
||||||
ang = *nang + pp->circle_camera_ang;
|
ang = fix16_to_int(*nq16ang) + pp->circle_camera_ang;
|
||||||
|
|
||||||
// Calculate the vector (nx,ny,nz) to shoot backwards
|
// Calculate the vector (nx,ny,nz) to shoot backwards
|
||||||
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 4);
|
vx = (sintable[NORM_ANGLE(ang + 1536)] >> 4);
|
||||||
|
@ -1336,7 +1336,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
flag_backup = hsp->cstat;
|
flag_backup = hsp->cstat;
|
||||||
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
RESET(hsp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
|
||||||
|
|
||||||
CircleCamera(nx, ny, nz, vsect, nang, horiz);
|
CircleCamera(nx, ny, nz, vsect, nq16ang, horiz);
|
||||||
hsp->cstat = flag_backup;
|
hsp->cstat = flag_backup;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1365,7 +1365,7 @@ CircleCamera(int *nx, int *ny, int *nz, short *vsect, int *nang, short horiz)
|
||||||
// Make sure vsect is correct
|
// Make sure vsect is correct
|
||||||
updatesectorz(*nx, *ny, *nz, vsect);
|
updatesectorz(*nx, *ny, *nz, vsect);
|
||||||
|
|
||||||
*nang = ang;
|
*nq16ang = fix16_from_int(ang);
|
||||||
}
|
}
|
||||||
|
|
||||||
FString GameInterface::statFPS()
|
FString GameInterface::statFPS()
|
||||||
|
@ -1576,7 +1576,7 @@ void DrawCrosshair(PLAYERp pp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, int *tang, int *thoriz)
|
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, fix16_t *tq16ang, fix16_t *tq16horiz)
|
||||||
{
|
{
|
||||||
int i,nexti;
|
int i,nexti;
|
||||||
short ang;
|
short ang;
|
||||||
|
@ -1617,7 +1617,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, int *tan
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
pp->last_camera_sp = sp;
|
pp->last_camera_sp = sp;
|
||||||
CircleCamera(tx, ty, tz, tsectnum, tang, 100);
|
CircleCamera(tx, ty, tz, tsectnum, tq16ang, 100);
|
||||||
found_camera = TRUE;
|
found_camera = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1643,14 +1643,14 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, int *tan
|
||||||
zvect = 0;
|
zvect = 0;
|
||||||
|
|
||||||
// new horiz to player
|
// new horiz to player
|
||||||
*thoriz = 100 - (zvect/256);
|
*tq16horiz = fix16_from_int(100 - (zvect/256));
|
||||||
*thoriz = max(*thoriz, PLAYER_HORIZ_MIN);
|
*tq16horiz = fix16_max(*tq16horiz, fix16_from_int(PLAYER_HORIZ_MIN));
|
||||||
*thoriz = min(*thoriz, PLAYER_HORIZ_MAX);
|
*tq16horiz = fix16_min(*tq16horiz, fix16_from_int(PLAYER_HORIZ_MAX));
|
||||||
|
|
||||||
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,thoriz %d",xvect,yvect,zvect,*thoriz);
|
//DSPRINTF(ds,"xvect %d,yvect %d,zvect %d,tq16horiz %d",xvect,yvect,zvect,*tq16horiz);
|
||||||
MONO_PRINT(ds);
|
MONO_PRINT(ds);
|
||||||
|
|
||||||
*tang = ang;
|
*tq16ang = fix16_from_int(ang);
|
||||||
*tx = sp->x;
|
*tx = sp->x;
|
||||||
*ty = sp->y;
|
*ty = sp->y;
|
||||||
*tz = sp->z;
|
*tz = sp->z;
|
||||||
|
@ -1930,7 +1930,7 @@ void
|
||||||
drawscreen(PLAYERp pp)
|
drawscreen(PLAYERp pp)
|
||||||
{
|
{
|
||||||
extern SWBOOL DemoMode,CameraTestMode;
|
extern SWBOOL DemoMode,CameraTestMode;
|
||||||
int tx, ty, tz, tinthoriz, tintang;
|
int tx, ty, tz;
|
||||||
fix16_t tq16horiz, tq16ang;
|
fix16_t tq16horiz, tq16ang;
|
||||||
short tsectnum;
|
short tsectnum;
|
||||||
short i,j;
|
short i,j;
|
||||||
|
@ -2084,8 +2084,7 @@ drawscreen(PLAYERp pp)
|
||||||
//if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE))
|
//if (TEST(camerapp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||||
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
|
||||||
{
|
{
|
||||||
tintang = fix16_to_int(tq16ang);
|
BackView(&tx, &ty, &tz, &tsectnum, &tq16ang, fix16_to_int(tq16horiz));
|
||||||
BackView(&tx, &ty, &tz, &tsectnum, &tintang, fix16_to_int(tq16horiz));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2093,9 +2092,7 @@ drawscreen(PLAYERp pp)
|
||||||
|
|
||||||
if (DemoMode || CameraTestMode)
|
if (DemoMode || CameraTestMode)
|
||||||
{
|
{
|
||||||
tinthoriz = fix16_to_int(tq16horiz);
|
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tq16ang, &tq16horiz);
|
||||||
tintang = fix16_to_int(tq16ang);
|
|
||||||
CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tintang, &tinthoriz);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -588,7 +588,7 @@ void TerminateGame(void)
|
||||||
|
|
||||||
bool LoadLevel(const char *filename)
|
bool LoadLevel(const char *filename)
|
||||||
{
|
{
|
||||||
int16_t q16ang = fix16_to_int(Player[0].q16ang);
|
int16_t q16ang;
|
||||||
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &q16ang, &Player[0].cursectnum) == -1)
|
if (engineLoadBoard(filename, SW_SHAREWARE ? 1 : 0, (vec3_t *)&Player[0], &q16ang, &Player[0].cursectnum) == -1)
|
||||||
{
|
{
|
||||||
Printf("Level not found: %s", filename);
|
Printf("Level not found: %s", filename);
|
||||||
|
@ -597,6 +597,7 @@ bool LoadLevel(const char *filename)
|
||||||
currentLevel = &mapList[Level];
|
currentLevel = &mapList[Level];
|
||||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||||
STAT_NewLevel(currentLevel->labelName);
|
STAT_NewLevel(currentLevel->labelName);
|
||||||
|
Player[0].q16ang = fix16_from_int(q16ang);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2406,7 +2406,7 @@ InitPlayerSprite(PLAYERp pp)
|
||||||
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
||||||
pp->Reverb = 0;
|
pp->Reverb = 0;
|
||||||
sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
|
sp_num = pp->PlayerSprite = SpawnSprite(STAT_PLAYER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx,
|
||||||
pp->posy, pp->posz, fix16_to_int(pp->q16ang), 50);
|
pp->posy, pp->posz, fix16_to_int(pp->q16ang), 0);
|
||||||
|
|
||||||
pp->SpriteP = sp = &sprite[sp_num];
|
pp->SpriteP = sp = &sprite[sp_num];
|
||||||
pp->pnum = pnum;
|
pp->pnum = pnum;
|
||||||
|
|
Loading…
Reference in a new issue