Commit b124f348 authored by Steven Fuller's avatar Steven Fuller

Moved a few things back into wl_draw.c (CalcProjection)

Added a stub function for a 'new' fizzle fade.
parent ec83e834
...@@ -29,7 +29,7 @@ B M - use something like config file or getenv to point at data directories ...@@ -29,7 +29,7 @@ B M - use something like config file or getenv to point at data directories
P I - finish handling/mapping for all keys in sys. specific code P I - finish handling/mapping for all keys in sys. specific code
B I - add mouse support B I - add mouse support
B M - add joystick/gamepad support B M - add joystick/gamepad support
P I - add an appropiate replacement where fizzlefade was P I - fill in the new fizzlefade function
P I - add sound "emulation" to the necessary targets so WaitSoundDone works P I - add sound "emulation" to the necessary targets so WaitSoundDone works
Complete: Complete:
......
...@@ -2443,25 +2443,21 @@ void A_StartDeathCam(objtype *ob) ...@@ -2443,25 +2443,21 @@ void A_StartDeathCam(objtype *ob)
} }
gamestate.victoryflag = true; gamestate.victoryflag = true;
VW_Bar(0, 0, 320, 200-STATUSLINES, 127);
/* TODO: fizzlefaze was here */ FizzleFade(false, 70, 127);
/* FizzleFade(0, 0, 320, 200-STATUSLINES, 70, false); */
CA_UpLevel(); CA_UpLevel();
CacheLump(LEVELEND_LUMP_START, LEVELEND_LUMP_END); CacheLump(LEVELEND_LUMP_START, LEVELEND_LUMP_END);
Write(0,7,STR_SEEAGAIN); Write(0, 7, STR_SEEAGAIN);
CA_DownLevel (); CA_DownLevel();
VW_UpdateScreen (); VW_UpdateScreen();
IN_UserInput(300); IN_UserInput(300);
// /* line angle up exactly */
// line angle up exactly
//
NewState (player,s_deathcam); NewState (player,s_deathcam);
player->x = gamestate.killx; player->x = gamestate.killx;
...@@ -2470,26 +2466,25 @@ void A_StartDeathCam(objtype *ob) ...@@ -2470,26 +2466,25 @@ void A_StartDeathCam(objtype *ob)
dx = ob->x - player->x; dx = ob->x - player->x;
dy = player->y - ob->y; dy = player->y - ob->y;
fangle = atan2(dy,dx); // returns -pi to pi fangle = atan2(dy, dx); /* returns -pi to pi */
if (fangle<0) if (fangle<0)
fangle = PI*2+fangle; fangle = PI*2+fangle;
player->angle = fangle/(PI*2)*ANGLES; player->angle = fangle/(PI*2)*ANGLES;
// /* try to position as close as possible without being in a wall */
// try to position as close as possible without being in a wall
//
dist = 0x14000l; dist = 0x14000l;
do do
{ {
xmove = FixedByFrac(dist,costable[player->angle]); xmove = FixedByFrac(dist, costable[player->angle]);
ymove = -FixedByFrac(dist,sintable[player->angle]); ymove = -FixedByFrac(dist, sintable[player->angle]);
player->x = ob->x - xmove; player->x = ob->x - xmove;
player->y = ob->y - ymove; player->y = ob->y - ymove;
dist += 0x1000; dist += 0x1000;
} while (!CheckPosition (player)); } while (!CheckPosition(player));
plux = player->x >> UNSIGNEDSHIFT; // scale to fit in unsigned plux = player->x >> UNSIGNEDSHIFT; // scale to fit in unsigned
pluy = player->y >> UNSIGNEDSHIFT; pluy = player->y >> UNSIGNEDSHIFT;
player->tilex = player->x >> TILESHIFT; // scale to tile values player->tilex = player->x >> TILESHIFT; // scale to tile values
......
...@@ -42,24 +42,25 @@ extern int vwidth, vheight; /* size of screen */ ...@@ -42,24 +42,25 @@ extern int vwidth, vheight; /* size of screen */
#define RUNSPEED 6000 #define RUNSPEED 6000
#define PLAYERSIZE MINDIST // player radius #define PLAYERSIZE MINDIST /* player radius */
#define MINACTORDIST 0x10000l // minimum dist from player center #define MINACTORDIST 0x10000 /* minimum dist from player center */
// to any actor center /* to any actor center */
#define GLOBAL1 (1l<<16) #define GLOBAL1 0x10000
#define TILEGLOBAL GLOBAL1 #define TILEGLOBAL GLOBAL1
#define TILESHIFT 16l #define VIEWGLOBAL GLOBAL1
#define TILESHIFT 16
#define UNSIGNEDSHIFT 8 #define UNSIGNEDSHIFT 8
#define ANGLES 360 // must be divisable by 4 #define ANGLES 360 /* must be divisible by 4 */
#define ANGLEQUAD (ANGLES/4) #define ANGLEQUAD (ANGLES/4)
#define FINEANGLES 3600 #define FINEANGLES 3600
#define MINDIST (0x5800l) #define MINDIST 0x5800
#define MAXVIEWWIDTH 1280 #define MAXVIEWWIDTH 1280
#define MAPSIZE 64 // maps are 64*64 max #define MAPSIZE 64 /* maps are 64*64 */
#define STATUSLINES 40 #define STATUSLINES 40
...@@ -676,8 +677,6 @@ typedef enum { ...@@ -676,8 +677,6 @@ typedef enum {
extern char str[80], str2[20]; extern char str[80], str2[20];
extern fixed focallength;
extern int viewwidth, viewheight; extern int viewwidth, viewheight;
extern int viewwidthwin, viewheightwin; extern int viewwidthwin, viewheightwin;
extern int xoffset, yoffset; extern int xoffset, yoffset;
...@@ -849,24 +848,18 @@ void PicturePause (void); ...@@ -849,24 +848,18 @@ void PicturePause (void);
extern long lasttimecount; extern long lasttimecount;
extern long frameon; extern long frameon;
// /* refresh variables */
// derived constants extern fixed viewx, viewy; /* the focal point */
// extern fixed viewsin, viewcos;
extern fixed scale;
extern long heightnumerator;
// extern int horizwall[], vertwall[];
// refresh variables
//
extern fixed viewx,viewy; // the focal point
extern fixed viewsin,viewcos;
extern int horizwall[],vertwall[]; fixed FixedByFrac(fixed a, fixed b);
void BuildTables();
void CalcTics();
void ThreeDRefresh();
fixed FixedByFrac (fixed a, fixed b); void FizzleFade(boolean abortable, int frames, int color);
void BuildTables (void);
void CalcTics (void);
void ThreeDRefresh (void);
/* /*
============================================================================= =============================================================================
......
...@@ -23,6 +23,10 @@ static long xintercept, yintercept; ...@@ -23,6 +23,10 @@ static long xintercept, yintercept;
static unsigned postx; static unsigned postx;
static fixed focallength;
static fixed scale;
static long heightnumerator;
static void AsmRefresh(); static void AsmRefresh();
#define NOASM #define NOASM
...@@ -41,6 +45,49 @@ void SimpleScaleShape(int xcenter, int shapenum, unsigned height); ...@@ -41,6 +45,49 @@ void SimpleScaleShape(int xcenter, int shapenum, unsigned height);
/* ======================================================================== */ /* ======================================================================== */
/*
====================
=
= CalcProjection
=
====================
*/
static const double radtoint = (double)FINEANGLES/2.0/PI;
void CalcProjection(long focal)
{
int i;
long intang;
double angle, tang, facedist;
int halfview;
focallength = focal;
facedist = focal+MINDIST;
halfview = viewwidth/2; /* half view in pixels */
/*
calculate scale value for vertical height calculations
and sprite x calculations
*/
scale = halfview*facedist/(VIEWGLOBAL/2);
/*
divide heightnumerator by a posts distance to get the posts height for
the heightbuffer. The pixel height is height>>2
*/
heightnumerator = (TILEGLOBAL*scale)>>6;
/* calculate the angle offset from view angle of each pixel's ray */
for (i = 0; i < halfview; i++) {
tang = ((double)i)*VIEWGLOBAL/viewwidth/facedist;
angle = atan(tang);
intang = angle*radtoint;
pixelangle[halfview-1-i] = intang;
pixelangle[halfview+i] = -intang;
}
}
/* /*
======================== ========================
= =
...@@ -626,18 +673,6 @@ void ThreeDRefresh() ...@@ -626,18 +673,6 @@ void ThreeDRefresh()
DrawPlayerWeapon(); /* draw player's hands */ DrawPlayerWeapon(); /* draw player's hands */
/* show screen and time last cycle */ /* show screen and time last cycle */
/* TODO: fizzlefaze was here */
/*
if (fizzlein)
{
FizzleFade(xoffset, yoffset, viewwidth, viewheight, 20, false);
fizzlein = false;
lasttimecount = 0;
set_TimeCount(0);
}
*/
VW_UpdateScreen(); VW_UpdateScreen();
frameon++; frameon++;
} }
...@@ -1212,3 +1247,9 @@ passhoriz: ...@@ -1212,3 +1247,9 @@ passhoriz:
goto horizcheck; goto horizcheck;
} }
} }
/* ======================================================================== */
void FizzleFade(boolean abortable, int frames, int color)
{
}
...@@ -982,10 +982,7 @@ void Died() ...@@ -982,10 +982,7 @@ void Died()
// //
FinishPaletteShifts(); FinishPaletteShifts();
VL_Bar(xoffset, yoffset, viewwidth, viewheight, 4); FizzleFade(false, 70, 4);
/* TODO: fizzlefade was here */
/* FizzleFade(xoffset, yoffset, viewwidth, viewheight, 70, false); */
IN_ClearKeysDown(); IN_ClearKeysDown();
......
...@@ -12,13 +12,10 @@ ...@@ -12,13 +12,10 @@
============================================================================= =============================================================================
*/ */
#define FOCALLENGTH 0x5700 // in global coordinates #define FOCALLENGTH 0x5800 /* in global coordinates */
#define VIEWGLOBAL 0x10000 // globals visable flush to wall
char str[80], str2[20]; char str[80], str2[20];
fixed focallength;
int viewwidth, viewheight; int viewwidth, viewheight;
int viewwidthwin, viewheightwin; /* for borders */ int viewwidthwin, viewheightwin; /* for borders */
int xoffset, yoffset; int xoffset, yoffset;
...@@ -27,8 +24,6 @@ int viewsize; ...@@ -27,8 +24,6 @@ int viewsize;
int centerx; int centerx;
int shootdelta; /* pixels away from centerx a target can be */ int shootdelta; /* pixels away from centerx a target can be */
fixed scale;
long heightnumerator;
boolean startgame,loadedgame; boolean startgame,loadedgame;
int mouseadjustment; int mouseadjustment;
...@@ -921,50 +916,6 @@ void BuildTables() ...@@ -921,50 +916,6 @@ void BuildTables()
} }
} }
/*
====================
=
= CalcProjection
=
====================
*/
void CalcProjection(long focal)
{
int i;
long intang;
double angle, tang, facedist;
int halfview;
focallength = focal;
facedist = focal+MINDIST;
halfview = viewwidth/2; // half view in pixels
//
// calculate scale value for vertical height calculations
// and sprite x calculations
//
scale = halfview*facedist/(VIEWGLOBAL/2);
//
// divide heightnumerator by a posts distance to get the posts height for
// the heightbuffer. The pixel height is height>>2
//
heightnumerator = (TILEGLOBAL*scale)>>6;
//
// calculate the angle offset from view angle of each pixel's ray
//
for (i = 0; i < halfview; i++) {
tang = ((double)i)*VIEWGLOBAL/viewwidth/facedist;
angle = atan(tang);
intang = angle*radtoint;
pixelangle[halfview-1-i] = intang;
pixelangle[halfview+i] = -intang;
}
}
/* /*
=================== ===================
= =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment