Commit f0d81dbd authored by Steven Fuller's avatar Steven Fuller

Almost there but something is wrong with the raycasting (specifically pixelangle?)

parent b2cc1455
CC = gcc CC = gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -mpentiumpro -mcpu=pentiumpro -march=pentiumpro -DUSEVGA #CFLAGS = -Wall -O6 -fomit-frame-pointer -mpentiumpro -mcpu=pentiumpro -march=pentiumpro -DUSEVGA
CFLAGS = -g -DUSEVGA CFLAGS = -g -DUSEVGA -fwritable-strings
#CFLAGS = -g -Wall -DUSEVGA -DDEBUG #CFLAGS = -g -Wall -DUSEVGA -DDEBUG
#CFLAGS = -g -DUSEVGA -DDEBUG #CFLAGS = -g -DUSEVGA -DDEBUG
#CFLAGS = -g -pg -DDEBUG #CFLAGS = -g -pg -DDEBUG
......
...@@ -7,3 +7,5 @@ code, it really needs to be cleaned up ...@@ -7,3 +7,5 @@ code, it really needs to be cleaned up
* id_ca.c cache code: nice idea but messy and maybe can be fixed * id_ca.c cache code: nice idea but messy and maybe can be fixed
in an effort to not allocate everything to memory and forget about it in an effort to not allocate everything to memory and forget about it
* remove virtualreality * remove virtualreality
* clean up header files, especially wl_def.h, where some externs arent in
the right place
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
typedef struct typedef struct
{ {
/* 0-255 is a character, > is a pointer to a node */ /* 0-255 is a character, > is a pointer to a node */
unsigned short int bit0,bit1; word bit0, bit1;
} PACKED huffnode; } PACKED huffnode;
typedef struct typedef struct
{ {
unsigned short int RLEWtag; word RLEWtag;
long headeroffsets[100]; long headeroffsets[100];
} PACKED mapfiletype; } PACKED mapfiletype;
...@@ -1576,7 +1576,7 @@ memptr PM_GetPage(int pagenum) ...@@ -1576,7 +1576,7 @@ memptr PM_GetPage(int pagenum)
page = &PMPages[pagenum]; page = &PMPages[pagenum];
if (page->addr == NULL) { if (page->addr == NULL) {
page->lastHit = 0; page->lastHit = 0;
MM_GetPtr(page->addr, PMPageSize); MM_GetPtr((memptr)&page->addr, PMPageSize);
PML_ReadFromFile(page->addr, page->offset, page->length); PML_ReadFromFile(page->addr, page->offset, page->length);
} }
page->lastHit++; page->lastHit++;
......
...@@ -14,7 +14,7 @@ typedef struct ...@@ -14,7 +14,7 @@ typedef struct
{ {
long planestart[3]; long planestart[3];
word planelength[3]; word planelength[3];
word width,height; word width, height;
char name[16]; char name[16];
} PACKED maptype; } PACKED maptype;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <values.h> #include <values.h>
#include <sys/types.h> #include <sys/types.h>
#include <glob.h> #include <glob.h>
#include <math.h>
#include "misc.h" #include "misc.h"
......
...@@ -529,8 +529,8 @@ void IN_Ack (void) ...@@ -529,8 +529,8 @@ void IN_Ack (void)
{ {
IN_StartAck (); IN_StartAck ();
while (!IN_CheckAck ()) return; /* TODO: fix when keyboard implemented */
; while (!IN_CheckAck ()) ;
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -546,12 +546,13 @@ boolean IN_UserInput(longword delay) ...@@ -546,12 +546,13 @@ boolean IN_UserInput(longword delay)
longword lasttime; longword lasttime;
lasttime = get_TimeCount(); lasttime = get_TimeCount();
IN_StartAck (); IN_StartAck ();
do do {
{
if (IN_CheckAck()) if (IN_CheckAck())
return true; return true;
} while ( (get_TimeCount() - lasttime) < delay ); } while ( (get_TimeCount() - lasttime) < delay );
return false; return false;
} }
......
...@@ -70,7 +70,7 @@ void VWB_DrawTile8 (int x, int y, int tile) ...@@ -70,7 +70,7 @@ void VWB_DrawTile8 (int x, int y, int tile)
LatchDrawChar(x,y,tile); LatchDrawChar(x,y,tile);
} }
void VWB_DrawPic (int x, int y, int chunknum) void VWB_DrawPic(int x, int y, int chunknum)
{ {
int picnum = chunknum - STARTPICS; int picnum = chunknum - STARTPICS;
unsigned width,height; unsigned width,height;
......
...@@ -8,15 +8,15 @@ ...@@ -8,15 +8,15 @@
typedef struct typedef struct
{ {
int width, height; word width, height;
} pictabletype; } PACKED pictabletype;
typedef struct typedef struct
{ {
int height; word height;
int location[256]; word location[256];
char width[256]; char width[256];
} fontstruct; } PACKED fontstruct;
/* ======================================================================== */ /* ======================================================================== */
......
#ifndef __WL_DEF_H__
#define __WL_DEF_H__
#include "id_heads.h" #include "id_heads.h"
#include <math.h>
#include <values.h>
#include "wl_menu.h" #include "wl_menu.h"
...@@ -731,8 +732,7 @@ extern fixed sintable[], *costable; ...@@ -731,8 +732,7 @@ extern fixed sintable[], *costable;
// //
// derived constants // derived constants
// //
extern fixed scale, maxslope; extern fixed maxslope;
extern long heightnumerator;
extern int minheightdiv; extern int minheightdiv;
extern char configname[13]; extern char configname[13];
...@@ -895,8 +895,6 @@ void PicturePause (void); ...@@ -895,8 +895,6 @@ void PicturePause (void);
============================================================================= =============================================================================
*/ */
extern unsigned screenloc[3];
extern long lasttimecount; extern long lasttimecount;
extern long frameon; extern long frameon;
extern boolean fizzlein; extern boolean fizzlein;
...@@ -907,13 +905,6 @@ extern fixed tileglobal; ...@@ -907,13 +905,6 @@ extern fixed tileglobal;
extern fixed focallength; extern fixed focallength;
extern fixed mindist; extern fixed mindist;
//
// math tables
//
extern int pixelangle[MAXVIEWWIDTH];
extern long finetangent[FINEANGLES/4];
extern fixed sintable[], *costable;
// //
// derived constants // derived constants
// //
...@@ -992,10 +983,10 @@ boolean CheckSight (objtype *ob); ...@@ -992,10 +983,10 @@ boolean CheckSight (objtype *ob);
typedef struct typedef struct
{ {
unsigned leftpix,rightpix; word leftpix,rightpix;
unsigned dataofs[64]; word dataofs[64];
/* table data after dataofs[rightpix-leftpix+1] */ /* table data after dataofs[rightpix-leftpix+1] */
} t_compshape; } PACKED t_compshape;
extern int maxscale,maxscaleshl2; extern int maxscale,maxscaleshl2;
...@@ -1178,3 +1169,7 @@ void SpawnHitler (int tilex, int tiley); ...@@ -1178,3 +1169,7 @@ void SpawnHitler (int tilex, int tiley);
extern void HelpScreens(void); extern void HelpScreens(void);
extern void EndText(void); extern void EndText(void);
#elif
#error "fix me TODO"
#endif
...@@ -17,8 +17,6 @@ fixed tileglobal = TILEGLOBAL; ...@@ -17,8 +17,6 @@ fixed tileglobal = TILEGLOBAL;
#define mindist MINDIST #define mindist MINDIST
unsigned char tempy[4096]; /* TODO: testing code only... */
// //
// math tables // math tables
// //
...@@ -785,18 +783,11 @@ void HitVertWall (void); ...@@ -785,18 +783,11 @@ void HitVertWall (void);
void HitHorizPWall (void); void HitHorizPWall (void);
void HitVertPWall (void); void HitVertPWall (void);
int tempylock;
void AsmRefresh (void) void AsmRefresh (void)
{ {
fixed doorxhit, dooryhit; fixed doorxhit, dooryhit;
int angle; /* ray angle through pixx */ int angle; /* ray angle through pixx */
int i;
tempylock = 1;
for (i = 0; i < 4096; i++) { /* TODO: testing */
tempy[i] = tilemap[i % 64][i / 64] ? '1' : '0';
}
for (pixx = 0; pixx < viewwidth; pixx++) { for (pixx = 0; pixx < viewwidth; pixx++) {
angle = midangle + pixelangle[pixx]; angle = midangle + pixelangle[pixx];
...@@ -870,7 +861,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */ ...@@ -870,7 +861,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */
printf ("vert: %d %x %d, %d\n", pixx, tilehit, xtile, TILE(yintercept)); printf ("vert: %d %x %d, %d\n", pixx, tilehit, xtile, TILE(yintercept));
#endif #endif
if (tilehit != 0) { if (tilehit != 0) {
tempy[xtile + TILE(yintercept) * 64] = 'X';
if (tilehit & 0x80) { if (tilehit & 0x80) {
if (tilehit & 0x40) { if (tilehit & 0x40) {
/* vertpushwall */ /* vertpushwall */
...@@ -916,7 +906,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */ ...@@ -916,7 +906,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */
printf ("horiz: %d %x %d, %d\n", pixx, tilehit, TILE(xintercept), ytile); printf ("horiz: %d %x %d, %d\n", pixx, tilehit, TILE(xintercept), ytile);
#endif #endif
if (tilehit != 0) { if (tilehit != 0) {
tempy[TILE(xintercept) + ytile * 64] = 'Y';
if (tilehit & 0x80) { if (tilehit & 0x80) {
/* horizdoor */ /* horizdoor */
if (tilehit & 0x40) { if (tilehit & 0x40) {
...@@ -954,7 +943,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */ ...@@ -954,7 +943,6 @@ for (i = 0; i < 4096; i++) { /* TODO: testing */
goto horizcheck; goto horizcheck;
nextpix: nextpix:
} }
tempylock = 0;
} }
......
...@@ -499,7 +499,7 @@ void ShutdownId (void) ...@@ -499,7 +499,7 @@ void ShutdownId (void)
================== ==================
*/ */
const float radtoint = (float)FINEANGLES/2/PI; const float radtoint = (float)FINEANGLES/2.0f/PI;
void BuildTables (void) void BuildTables (void)
{ {
...@@ -1095,7 +1095,7 @@ void InitGame (void) ...@@ -1095,7 +1095,7 @@ void InitGame (void)
BuildTables (); // trig tables BuildTables (); // trig tables
SetupWalls (); SetupWalls ();
NewViewSize (viewsize); NewViewSize(viewsize);
// //
...@@ -1170,7 +1170,7 @@ void ShowViewSize (int width) ...@@ -1170,7 +1170,7 @@ void ShowViewSize (int width)
} }
void NewViewSize (int width) void NewViewSize(int width)
{ {
CA_UpLevel (); CA_UpLevel ();
MM_SortMem (); MM_SortMem ();
...@@ -1258,20 +1258,11 @@ void Quit (char *error) ...@@ -1258,20 +1258,11 @@ void Quit (char *error)
void DemoLoop (void) void DemoLoop (void)
{ {
static int LastDemo; static int LastDemo;
int i,level;
long nsize;
memptr nullblock;
// //
// main game cycle // main game cycle
// //
// nsize = (long)40*1024;
// MM_GetPtr(&nullblock,nsize);
#ifndef DEMOTEST
#ifndef UPLOAD #ifndef UPLOAD
#ifndef GOODTIMES #ifndef GOODTIMES
...@@ -1297,8 +1288,6 @@ void DemoLoop (void) ...@@ -1297,8 +1288,6 @@ void DemoLoop (void)
#ifndef JAPAN #ifndef JAPAN
if (!NoWait) if (!NoWait)
PG13 (); PG13 ();
#endif
#endif #endif
while (1) while (1)
...@@ -1309,8 +1298,6 @@ void DemoLoop (void) ...@@ -1309,8 +1298,6 @@ void DemoLoop (void)
// title page // title page
// //
MM_SortMem (); MM_SortMem ();
#ifndef DEMOTEST
#ifdef SPEAR #ifdef SPEAR
CA_CacheGrChunk (TITLEPALETTE); CA_CacheGrChunk (TITLEPALETTE);
...@@ -1351,7 +1338,6 @@ void DemoLoop (void) ...@@ -1351,7 +1338,6 @@ void DemoLoop (void)
if (IN_UserInput(TickBase*10)) if (IN_UserInput(TickBase*10))
break; break;
#endif
// //
// demo // demo
// //
......
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