Commit 0f888293 authored by Steven Fuller's avatar Steven Fuller

* Added a NoEnemies debug-type hack

* Walls appear to be drawn correctly
* Moved some palette and floor clearing functions to specific draw files
* Sprites are shown -- just with wall textures.
parent 66b71f73
...@@ -40,12 +40,6 @@ void InitYTable(void) ...@@ -40,12 +40,6 @@ void InitYTable(void)
} while (++i<480); } while (++i<480);
} }
/**********************************
Palette Manager
**********************************/
/********************************** /**********************************
Load and set a palette resource Load and set a palette resource
...@@ -58,20 +52,6 @@ void SetAPalette(Word PalNum) ...@@ -58,20 +52,6 @@ void SetAPalette(Word PalNum)
ReleaseAResource(PalNum); /* Release the resource */ ReleaseAResource(PalNum); /* Release the resource */
} }
/**********************************
Load and set a palette from a pointer
**********************************/
Byte CurrentPal[768];
void SetAPalettePtr(unsigned char *PalPtr)
{
memcpy(&CurrentPal, PalPtr, 768);
SetPalette(PalPtr);
}
/********************************** /**********************************
Fade the screen to black Fade the screen to black
...@@ -82,7 +62,7 @@ void FadeToBlack(void) ...@@ -82,7 +62,7 @@ void FadeToBlack(void)
{ {
unsigned char MyPal[768]; unsigned char MyPal[768];
memset(MyPal,0,sizeof(MyPal)); /* Fill with black */ memset(MyPal, 0, sizeof(MyPal)); /* Fill with black */
MyPal[0] = MyPal[1] = MyPal[2] = 255; MyPal[0] = MyPal[1] = MyPal[2] = 255;
FadeToPtr(MyPal); FadeToPtr(MyPal);
} }
...@@ -99,45 +79,6 @@ void FadeTo(Word RezNum) ...@@ -99,45 +79,6 @@ void FadeTo(Word RezNum)
ReleaseAResource(RezNum); ReleaseAResource(RezNum);
} }
/**********************************
Fade the palette
**********************************/
void FadeToPtr(unsigned char *PalPtr)
{
int DestPalette[768]; /* Dest offsets */
Byte WorkPalette[768]; /* Palette to draw */
Byte SrcPal[768];
Word Count;
Word i;
if (!memcmp(PalPtr,&CurrentPal,768)) { /* Same palette? */
return;
}
memcpy(SrcPal,CurrentPal,768);
i = 0;
do { /* Convert the source palette to ints */
DestPalette[i] = PalPtr[i];
} while (++i<768);
i = 0;
do {
DestPalette[i] -= SrcPal[i]; /* Convert to delta's */
} while (++i<768);
Count = 1;
do {
i = 0;
do {
WorkPalette[i] = ((DestPalette[i] * (int)(Count)) / 16) + SrcPal[i];
} while (++i<768);
SetAPalettePtr(WorkPalette);
WaitTicks(1);
} while (++Count<17);
}
/********************************** /**********************************
Resource manager subsystem Resource manager subsystem
......
...@@ -37,6 +37,7 @@ Word nummissiles; /* Number of active missiles */ ...@@ -37,6 +37,7 @@ Word nummissiles; /* Number of active missiles */
missile_t missiles[MAXMISSILES]; /* Data for the missile items */ missile_t missiles[MAXMISSILES]; /* Data for the missile items */
Word numactors; /* Number of active actors */ Word numactors; /* Number of active actors */
actor_t actors[MAXACTORS]; /* Data for the actors */ actor_t actors[MAXACTORS]; /* Data for the actors */
Word NoEnemies = 0; /* No Enemies Debug Mode */
unsigned char **GameShapes; /* Pointer to the game shape array */ unsigned char **GameShapes; /* Pointer to the game shape array */
Word difficulty; /* 0 = easy, 1= normal, 2=hard*/ Word difficulty; /* 0 = easy, 1= normal, 2=hard*/
gametype_t gamestate; /* Status of the game (Save game) */ gametype_t gamestate; /* Status of the game (Save game) */
......
...@@ -28,6 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -28,6 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern Byte Pal[768]; extern Byte Pal[768];
void FadeToPtr(unsigned char *PalPtr)
{
SetPalette(PalPtr);
}
void SetAPalettePtr(unsigned char *PalPtr)
{
SetPalette(PalPtr);
}
void ClearTheScreen(Word c) void ClearTheScreen(Word c)
{ {
glClearColor((double)Pal[c*3+0]/256.0, (double)Pal[c*3+1]/256.0, (double)Pal[c*3+2]/256.0, 0.0); glClearColor((double)Pal[c*3+0]/256.0, (double)Pal[c*3+1]/256.0, (double)Pal[c*3+2]/256.0, 0.0);
...@@ -70,28 +80,46 @@ Byte *Pal256toRGB(Byte *dat, int len, Byte *pal) ...@@ -70,28 +80,46 @@ Byte *Pal256toRGB(Byte *dat, int len, Byte *pal)
return buf; return buf;
} }
Byte *Pal256toRGBA(Byte *dat, int len, Byte *pal) Byte *FlipWall(Byte *dat, int w, int h)
{ {
Byte *buf; Byte *buf;
int i; int i, j;
buf = (Byte *)malloc(len * 4); buf = (Byte *)malloc(w * h);
for (i = 0; i < len; i++) {
buf[i*4+0] = pal[dat[i]*3+0];
buf[i*4+1] = pal[dat[i]*3+1];
buf[i*4+2] = pal[dat[i]*3+2];
}
for (j = 0; j < h; j++)
for (i = 0; i < w; i++)
buf[(h-j-1)*w+(w-i-1)] = dat[i*w+j];
return buf; return buf;
} }
void DrawSprites(void) void IO_ClearViewBuffer()
{ {
} glBindTexture(GL_TEXTURE_2D, 0);
void DrawTopSprite(void) /* glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); */
{ glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glColor3b(Pal[0x2F*3+0], Pal[0x2F*3+1], Pal[0x2F*3+2]);
glRectf(-1, 0, 1, 1);
glColor3b(Pal[0x2A*3+0], Pal[0x2A*3+1], Pal[0x2A*3+2]);
glRectf(1, -1, -1, 0);
glColor3f(1.0, 1.0, 1.0);
glEnable(GL_DEPTH_TEST);
glPopMatrix();
} }
GLuint waltex[64]; GLuint waltex[64];
...@@ -112,20 +140,25 @@ void InitRenderView() ...@@ -112,20 +140,25 @@ void InitRenderView()
pal = LoadAResource(rGamePal); pal = LoadAResource(rGamePal);
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
Byte *buf; Byte *buf, *buf2;
glBindTexture(GL_TEXTURE_2D, waltex[i]); glBindTexture(GL_TEXTURE_2D, waltex[i]);
if (ArtData[i] == NULL) { if (ArtData[i] == NULL) {
glDeleteTextures(1, &waltex[i]); glDeleteTextures(1, &waltex[i]);
glEnable(GL_TEXTURE_2D);
waltex[i] = 0; waltex[i] = 0;
continue; continue;
} }
buf = Pal256toRGB(ArtData[i], 128 * 128, pal); buf2 = FlipWall(ArtData[i], 128, 128);
buf = Pal256toRGB(buf2, 128 * 128, pal);
free(buf2);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
/*
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
...@@ -133,16 +166,18 @@ void InitRenderView() ...@@ -133,16 +166,18 @@ void InitRenderView()
free(buf); free(buf);
} }
ReleaseAResource(rGamePal); ReleaseAResource(rGamePal);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearColor(0.0, 0.0, 0.0, 0.0); glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
//glFrustum(-0.286751, 0.286751, -0.288675, 0.288675, 0.200000, 182.000000);
glFrustum(-0.20, 0.20, -0.288675, 0.288675, 0.200000, 182.000000); glFrustum(-0.20, 0.20, -0.288675, 0.288675, 0.2, 182.0);
//glFrustum(-0.1, 0.1, -0.1, 0.1, .50000, 182.000000);
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
glCullFace(GL_BACK); glCullFace(GL_BACK);
...@@ -151,15 +186,75 @@ void InitRenderView() ...@@ -151,15 +186,75 @@ void InitRenderView()
void StartRenderView() void StartRenderView()
{ {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); /* glLoadIdentity(); */
glRotatef(270.0-((double)gamestate.viewangle / (double)ANGLES * 360.0), 0.0, 1.0, 0.0); glRotatef(270.0-((double)gamestate.viewangle / (double)ANGLES * 360.0), 0.0, 1.0, 0.0);
//glTranslatef(-(double)actors[0].x / 256.0, 0, (double)actors[0].y / 256.0);
glTranslatef((double)actors[0].x / 256.0, 0, (double)actors[0].y / 256.0); glTranslatef((double)actors[0].x / 256.0, 0, (double)actors[0].y / 256.0);
} }
void DrawSprite(thing_t *t)
{
glPushMatrix();
glTranslatef(-(double)t->x / 256.0, 0, -(double)t->y / 256.0);
glRotatef(90.0+((double)gamestate.viewangle / (double)ANGLES * 360.0), 0.0, 1.0, 0.0);
glBegin(GL_QUADS);
glTexCoord2f(1.0, 1.0); glVertex2f( 0.5, -1);
glTexCoord2f(0.0, 1.0); glVertex2f( 0.5, 1);
glTexCoord2f(0.0, 0.0); glVertex2f(-0.5, 1);
glTexCoord2f(1.0, 0.0); glVertex2f(-0.5, -1);
glEnd();
glPopMatrix();
}
void DrawSprites(void)
{
Word i;
static_t *stat;
actor_t *actor;
missile_t *MissilePtr;
//glRotatef(360.0 - (270.0-((double)gamestate.viewangle / (double)ANGLES * 360.0)), 0.0, 1.0, 0.0);
//glRotatef((((double)gamestate.viewangle / (double)ANGLES * 360.0)), 0.0, 1.0, 0.0);
if (numstatics) {
i = numstatics;
stat = statics;
do {
if (areavis[stat->areanumber])
DrawSprite((thing_t *)stat);
++stat;
} while (--i);
}
if (numactors > 1) {
i = 1;
actor = &actors[1];
do {
if (areavis[actor->areanumber])
DrawSprite((thing_t *)actor);
++actor;
} while (++i<numactors);
}
if (nummissiles) {
i = nummissiles;
MissilePtr = missiles;
do {
if (areavis[MissilePtr->areanumber])
DrawSprite((thing_t *)MissilePtr);
++MissilePtr;
} while (--i);
}
}
void DrawTopSprite(void)
{
}
int WallSeen = 0; int WallSeen = 0;
void WallIsSeen(saveseg_t *seg) void WallIsSeen(saveseg_t *seg)
...@@ -263,7 +358,6 @@ void P_DrawSeg(saveseg_t *seg) ...@@ -263,7 +358,6 @@ void P_DrawSeg(saveseg_t *seg)
door_t *door_p; door_t *door_p;
unsigned short span, tspan; unsigned short span, tspan;
unsigned short angle1, angle2; unsigned short angle1, angle2;
int texslide;
WallSeen = 0; WallSeen = 0;
...@@ -285,19 +379,14 @@ void P_DrawSeg(saveseg_t *seg) ...@@ -285,19 +379,14 @@ void P_DrawSeg(saveseg_t *seg)
} }
} }
/* get texture*/
if (seg->texture >= 129) { /* segment is a door */ if (seg->texture >= 129) { /* segment is a door */
door = seg->texture - 129; /* Which door is this? */ door = seg->texture - 129; /* Which door is this? */
door_p = &doors[door]; door_p = &doors[door];
rw_texture = &textures[129 + (door_p->info>>1)][0]; rw_mintex += door_p->position;
texslide = door_p->position;
rw_mintex += texslide;
} else {
texslide = 0;
rw_texture = &textures[seg->texture][0];
} }
/* get texture*/
switch (seg->dir&3) { /* mask off the flags*/ switch (seg->dir&3) { /* mask off the flags*/
case di_north: case di_north:
if (viewx <= segplane) { if (viewx <= segplane) {
...@@ -365,70 +454,116 @@ void P_DrawSeg(saveseg_t *seg) ...@@ -365,70 +454,116 @@ void P_DrawSeg(saveseg_t *seg)
void P_DrawSegx(saveseg_t *seg) void P_DrawSegx(saveseg_t *seg)
{ {
GLfloat min, max; GLfloat min, max, plane, pos, texslide;
GLfloat smin, smax;
Word door = -1;
door_t *door_p;
Byte *tex; Byte *tex;
int i, t; int i, t;
tex = &textures[seg->texture][0]; plane = -((float)seg->plane)/2.0;
if (waltex[i]) if (seg == pwallseg) { /* Is this the active pushwall? */
glBindTexture(GL_TEXTURE_2D, waltex[i]); if (seg->dir&1) { /* east/west */
else plane += -(float)PushWallRec.pwallychange / 256.0;
fprintf(stderr, "ERROR: 0 texture in P_DrawSegx!\n"); } else { /* north/south */
plane += -(float)PushWallRec.pwallxchange / 256.0;
}
}
max = (seg->max - seg->min) / 2.0f;
/*
i = seg->min;
min = (float)i - seg->min;
*/
if (seg->min & 1)
min = -0.5f;
else
min = 0.0f; min = 0.0f;
max = 1.0f;
if (seg->texture >= 129) {
door = seg->texture - 129;
door_p = &doors[door];
texslide = (float)door_p->position / 256.0f;
tex = &textures[129 + (door_p->info>>1)][0];
} else {
texslide = 0.0f;
tex = &textures[seg->texture][0];
}
for (i = seg->min; i < seg->max;) {
for (i = seg->min >> 1; i < (seg->max >> 1); i++) { t = tex[i >> 1];
t = tex[i]; pos = ((double)i) / 2.0f;
if (i == seg->min) {
if (i & 1) {
min = 0.5;
i++;
} else {
i+=2;
min = 0.0;
}
max = 1.0f;
} /* else if (i == (seg->max-1)) {
min = 0.0f;
max = 0.5f;
i += 2;
} */ else {
min = 0.0f;
max = 1.0f;
i += 2;
}
smin = -((float)pos + texslide);
smax = -((float)pos + (max - min));
if (waltex[t]) if (waltex[t])
glBindTexture(GL_TEXTURE_2D, waltex[t]); glBindTexture(GL_TEXTURE_2D, waltex[t]);
else else
fprintf(stderr, "ERROR: 0 texture in P_DrawSegx!\n"); fprintf(stderr, "ERROR: 0 texture in P_DrawSegx!\n");
if (seg->min & 1)
min = 0.5f;
else
min = 0.0f;
max = 1.0f;
glBegin(GL_QUADS); glBegin(GL_QUADS);
switch(seg->dir&3) { switch(seg->dir&3) {
case di_north: case di_north:
glTexCoord2f(min, 0.0); glVertex3f(-(seg->plane)/2.0, -1, -min); if (door != -1) {
glTexCoord2f(min, 1.0); glVertex3f(-(seg->plane)/2.0, 1, -min); min += texslide;
glTexCoord2f(max, 1.0); glVertex3f(-(seg->plane)/2.0, 1, -max); glTexCoord2f(max, 0.0); glVertex3f(plane, -1, smin);
glTexCoord2f(max, 0.0); glVertex3f(-(seg->plane)/2.0, -1, -max); glTexCoord2f(min, 0.0); glVertex3f(plane, -1, smax);
glTexCoord2f(min, 1.0); glVertex3f(plane, 1, smax);
glTexCoord2f(max, 1.0); glVertex3f(plane, 1, smin);
} else {
glTexCoord2f(min, 0.0); glVertex3f(plane, -1, smin);
glTexCoord2f(max, 0.0); glVertex3f(plane, -1, smax);
glTexCoord2f(max, 1.0); glVertex3f(plane, 1, smax);
glTexCoord2f(min, 1.0); glVertex3f(plane, 1, smin);
}
break; break;
case di_south: case di_south:
glTexCoord2f(min, 0.0); glVertex3f(-(seg->plane)/2.0, -1, -(seg->max)/2.0); min += texslide;
glTexCoord2f(min, 1.0); glVertex3f(-(seg->plane)/2.0, 1, -(seg->max)/2.0); if (min == 0.5 && texslide == 0.0) { min -= 0.5; max -= 0.5; }
glTexCoord2f(max, 1.0); glVertex3f(-(seg->plane)/2.0, 1, -(seg->min)/2.0); glTexCoord2f(max, 0.0); glVertex3f(plane, -1, smin);
glTexCoord2f(max, 0.0); glVertex3f(-(seg->plane)/2.0, -1, -(seg->min)/2.0); glTexCoord2f(min, 0.0); glVertex3f(plane, -1, smax);
glTexCoord2f(min, 1.0); glVertex3f(plane, 1, smax);
glTexCoord2f(max, 1.0); glVertex3f(plane, 1, smin);
break; break;
case di_east: case di_east:
glTexCoord2f(min, 0.0); glVertex3f(-(seg->max)/2.0, -1, -(seg->plane)/2.0); min += texslide;
glTexCoord2f(min, 1.0); glVertex3f(-(seg->max)/2.0, 1, -(seg->plane)/2.0); if (min == 0.5 && texslide == 0.0) { min -= 0.5; max -= 0.5; }
glTexCoord2f(max, 1.0); glVertex3f(-(seg->min)/2.0, 1, -(seg->plane)/2.0); glTexCoord2f(max, 0.0); glVertex3f(smin, -1, plane);
glTexCoord2f(max, 0.0); glVertex3f(-(seg->min)/2.0, -1, -(seg->plane)/2.0); glTexCoord2f(min, 0.0); glVertex3f(smax, -1, plane);
glTexCoord2f(min, 1.0); glVertex3f(smax, 1, plane);
glTexCoord2f(max, 1.0); glVertex3f(smin, 1, plane);
break; break;
case di_west: case di_west:
glTexCoord2f(min, 0.0); glVertex3f(-(seg->min)/2.0, -1, -(seg->plane)/2.0); if (door != -1) {
glTexCoord2f(min, 1.0); glVertex3f(-(seg->min)/2.0, 1, -(seg->plane)/2.0); min += texslide;
glTexCoord2f(max, 1.0); glVertex3f(-(seg->max)/2.0, 1, -(seg->plane)/2.0); glTexCoord2f(max, 0.0); glVertex3f(smin, -1, plane);
glTexCoord2f(max, 0.0); glVertex3f(-(seg->max)/2.0, -1, -(seg->plane)/2.0); glTexCoord2f(min, 0.0); glVertex3f(smax, -1, plane);
glTexCoord2f(min, 1.0); glVertex3f(smax, 1, plane);
glTexCoord2f(max, 1.0); glVertex3f(smin, 1, plane);
} else {
glTexCoord2f(min, 0.0); glVertex3f(smin, -1, plane);
glTexCoord2f(max, 0.0); glVertex3f(smax, -1, plane);
glTexCoord2f(max, 1.0); glVertex3f(smax, 1, plane);
glTexCoord2f(min, 1.0); glVertex3f(smin, 1, plane);
}
break; break;
} }
glEnd(); glEnd();
} }
} }
...@@ -300,10 +300,12 @@ void LevelCompleted (void) ...@@ -300,10 +300,12 @@ void LevelCompleted (void)
if (gamestate.treasurecount == gamestate.treasuretotal) { if (gamestate.treasurecount == gamestate.treasuretotal) {
k++; /* Perfect treasure */ k++; /* Perfect treasure */
} }
if (!NoEnemies) {
RollRatio(RATIOX,RATIOY2,(gamestate.killcount*100)/gamestate.killtotal); RollRatio(RATIOX,RATIOY2,(gamestate.killcount*100)/gamestate.killtotal);
if (gamestate.killcount == gamestate.killtotal) { if (gamestate.killcount == gamestate.killtotal) {
k++; /* Perfect kills */ k++; /* Perfect kills */
} }
}
RollRatio(RATIOX,RATIOY3,(gamestate.secretcount*100)/gamestate.secrettotal); RollRatio(RATIOX,RATIOY3,(gamestate.secretcount*100)/gamestate.secrettotal);
if (gamestate.secretcount == gamestate.secrettotal) { if (gamestate.secretcount == gamestate.secrettotal) {
k++; /* Perfect secret */ k++; /* Perfect secret */
......
...@@ -300,6 +300,9 @@ void SpawnStand(Word x,Word y,class_t which) ...@@ -300,6 +300,9 @@ void SpawnStand(Word x,Word y,class_t which)
Word *TilePtr; Word *TilePtr;
Word tile; Word tile;
if (NoEnemies) /* DEBUG MODE */
return;
if (numactors >= MAXACTORS) { if (numactors >= MAXACTORS) {
fprintf("SpawnStand DEBUG (%d, %d)\n", numactors, MAXACTORS); fprintf("SpawnStand DEBUG (%d, %d)\n", numactors, MAXACTORS);
} }
...@@ -347,6 +350,9 @@ void SpawnAmbush(Word x,Word y,class_t which) ...@@ -347,6 +350,9 @@ void SpawnAmbush(Word x,Word y,class_t which)
{ {
actor_t *ActorPtr; actor_t *ActorPtr;
if (NoEnemies) /* DEBUG MODE */
return;
if (numactors >= MAXACTORS) { if (numactors >= MAXACTORS) {
fprintf("SpawnAmbush DEBUG (%d, %d)\n", numactors, MAXACTORS); fprintf("SpawnAmbush DEBUG (%d, %d)\n", numactors, MAXACTORS);
} }
......
...@@ -453,10 +453,10 @@ void RenderView(void) ...@@ -453,10 +453,10 @@ void RenderView(void)
viewcos = costable[gamestate.viewangle]; /* Get the basic cosine */ viewcos = costable[gamestate.viewangle]; /* Get the basic cosine */
memset(areavis, 0, sizeof(areavis)); /* No areas are visible */ memset(areavis, 0, sizeof(areavis)); /* No areas are visible */
IO_ClearViewBuffer(); /* Erase to ceiling / floor colors*/
StartRenderView(); /* Marker to let GL code know */ StartRenderView(); /* Marker to let GL code know */
ClearClipSegs(); /* Clip first seg only to sides of screen */ ClearClipSegs(); /* Clip first seg only to sides of screen */
IO_ClearViewBuffer(); /* Erase to ceiling / floor colors*/
bspcoord[BSPTOP] = 0; /* The map is 64*64 */ bspcoord[BSPTOP] = 0; /* The map is 64*64 */
bspcoord[BSPBOTTOM] = 64*FRACUNIT; bspcoord[BSPBOTTOM] = 64*FRACUNIT;
......
...@@ -19,6 +19,95 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -19,6 +19,95 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "wolfdef.h" #include "wolfdef.h"
/**********************************
Load and set a palette from a pointer
**********************************/
Byte CurrentPal[768];
void SetAPalettePtr(unsigned char *PalPtr)
{
memcpy(&CurrentPal, PalPtr, 768);
SetPalette(PalPtr);
}
/**********************************
Fade the palette
**********************************/
void FadeToPtr(unsigned char *PalPtr)
{
int DestPalette[768]; /* Dest offsets */
Byte WorkPalette[768]; /* Palette to draw */
Byte SrcPal[768];
Word Count;
Word i;
if (!memcmp(PalPtr,&CurrentPal,768)) { /* Same palette? */
return;
}
memcpy(SrcPal,CurrentPal,768);
i = 0;
do { /* Convert the source palette to ints */
DestPalette[i] = PalPtr[i];
} while (++i<768);
i = 0;
do {
DestPalette[i] -= SrcPal[i]; /* Convert to delta's */
} while (++i<768);
Count = 1;
do {
i = 0;
do {
WorkPalette[i] = ((DestPalette[i] * (int)(Count)) / 16) + SrcPal[i];
} while (++i<768);
SetAPalettePtr(WorkPalette);
WaitTicks(1);
} while (++Count<17);
}
/**********************************
Erase the floor and ceiling
**********************************/
void IO_ClearViewBuffer(void)
{
unsigned char *Screenad;
Word Count,WCount;
LongWord *LScreenad;
LongWord Fill;
Screenad = VideoPointer;
Count = VIEWHEIGHT/2;
Fill = 0x2f2f2f2f;
do {
WCount = SCREENWIDTH/4;
LScreenad = (LongWord *) Screenad;
do {
*LScreenad++ = Fill; /* 004 */
} while (--WCount);
Screenad+=VideoWidth;
} while (--Count);
Count = VIEWHEIGHT/2;
Fill = 0x2A2A2A2A;
do {
WCount = SCREENWIDTH/4;
LScreenad = (LongWord *) Screenad;
do {
*LScreenad++ = Fill;
} while (--WCount);
Screenad+=VideoWidth;
} while (--Count);
}
void ScaledDraw(Byte *gfx, Word scale, Byte *vid, LongWord TheFrac, Word TheInt, Word Width, LongWord Delta) void ScaledDraw(Byte *gfx, Word scale, Byte *vid, LongWord TheFrac, Word TheInt, Word Width, LongWord Delta)
{ {
LongWord OldDelta; LongWord OldDelta;
......
...@@ -223,42 +223,6 @@ void IO_DrawStatusBar(void) ...@@ -223,42 +223,6 @@ void IO_DrawStatusBar(void)
DrawShape(ScaleX(0),ScaleY(160),GameShapes[46]); DrawShape(ScaleX(0),ScaleY(160),GameShapes[46]);
} }
/**********************************
Erase the floor and ceiling
**********************************/
void IO_ClearViewBuffer(void)
{
unsigned char *Screenad;
Word Count,WCount;
LongWord *LScreenad;
LongWord Fill;
Screenad = VideoPointer;
Count = VIEWHEIGHT/2;
Fill = 0x2f2f2f2f;
do {
WCount = SCREENWIDTH/4;
LScreenad = (LongWord *) Screenad;
do {
*LScreenad++ = Fill; /* 004 */
} while (--WCount);
Screenad+=VideoWidth;
} while (--Count);
Count = VIEWHEIGHT/2;
Fill = 0x2A2A2A2A;
do {
WCount = SCREENWIDTH/4;
LScreenad = (LongWord *) Screenad;
do {
*LScreenad++ = Fill;
} while (--WCount);
Screenad+=VideoWidth;
} while (--Count);
}
/********************************** /**********************************
Copy the 3-D screen to display memory Copy the 3-D screen to display memory
......
...@@ -173,6 +173,8 @@ int main(int argc, char *argv[]) ...@@ -173,6 +173,8 @@ int main(int argc, char *argv[])
ClearTheScreen(BLACK); ClearTheScreen(BLACK);
BlastScreen(); BlastScreen();
NoEnemies = 1;
return WolfMain(argc, argv); return WolfMain(argc, argv);
} }
...@@ -255,6 +257,7 @@ Word NewGameWindow(Word NewVidSize) ...@@ -255,6 +257,7 @@ Word NewGameWindow(Word NewVidSize)
sizehints.flags = PMinSize | PMaxSize | PBaseSize; sizehints.flags = PMinSize | PMaxSize | PBaseSize;
XSetWMNormalHints(dpy, win, &sizehints); XSetWMNormalHints(dpy, win, &sizehints);
XResizeWindow(dpy, win, w, h); XResizeWindow(dpy, win, w, h);
XSync(dpy, False);
glViewport(0, 0, w, h); glViewport(0, 0, w, h);
gfxbuf = (Byte *)malloc(w * h); gfxbuf = (Byte *)malloc(w * h);
......
...@@ -826,6 +826,7 @@ extern Word nummissiles; /* Number of active missiles */ ...@@ -826,6 +826,7 @@ extern Word nummissiles; /* Number of active missiles */
extern missile_t missiles[MAXMISSILES]; /* Data for the missile items */ extern missile_t missiles[MAXMISSILES]; /* Data for the missile items */
extern Word numactors; /* Number of active actors */ extern Word numactors; /* Number of active actors */
extern actor_t actors[MAXACTORS]; /* Data for the actors */ extern actor_t actors[MAXACTORS]; /* Data for the actors */
extern Word NoEnemies; /* No Enemies Debug Mode */
extern Byte **GameShapes; /* Pointer to the game shape array */ extern Byte **GameShapes; /* Pointer to the game shape array */
extern Word difficulty; /* 0 = easy, 1= normal, 2=hard*/ extern Word difficulty; /* 0 = easy, 1= normal, 2=hard*/
extern gametype_t gamestate; /* Status of the game (Save game) */ extern gametype_t gamestate; /* Status of the game (Save game) */
......
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