Commit f2c29483 authored by Steven Fuller's avatar Steven Fuller

Source compiles cleanly with -Wall (except for one or two warnings)

parent cadd1aa5
CC = gcc CC = gcc
#CFLAGS = -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro #CFLAGS = -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall CFLAGS = -g -Wall
CFLAGS = -g #CFLAGS = -g
#CFLAGS = -Os #CFLAGS = -Os
OBJS = objs.o misc.o id_ca.o id_sd.o id_vh.o id_us.o \ OBJS = objs.o misc.o id_ca.o id_sd.o id_vh.o id_us.o \
wl_act1.o wl_act2.o wl_agent.o wl_game.o \ wl_act1.o wl_act2.o wl_agent.o wl_game.o \
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <values.h> #include <values.h>
#include <sys/types.h> #include <sys/types.h>
......
...@@ -33,8 +33,6 @@ HighScore Scores[MaxScores] = { ...@@ -33,8 +33,6 @@ HighScore Scores[MaxScores] = {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void US_Startup() void US_Startup()
{ {
int i,n;
if (US_Started) if (US_Started)
return; return;
......
...@@ -134,14 +134,12 @@ void LatchDrawPic(unsigned x, unsigned y, unsigned picnum) ...@@ -134,14 +134,12 @@ void LatchDrawPic(unsigned x, unsigned y, unsigned picnum)
=================== ===================
*/ */
void LoadLatchMem(void) void LoadLatchMem()
{ {
int i; int i;
/* tile 8s */
CA_CacheGrChunk (STARTTILE8); CA_CacheGrChunk (STARTTILE8);
/* pics */
for (i = LATCHPICS_LUMP_START; i <= LATCHPICS_LUMP_END; i++) { for (i = LATCHPICS_LUMP_START; i <= LATCHPICS_LUMP_END; i++) {
/* TODO: this just caches them for eternity */ /* TODO: this just caches them for eternity */
CA_CacheGrChunk (i); CA_CacheGrChunk (i);
...@@ -218,9 +216,8 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps) ...@@ -218,9 +216,8 @@ void VL_FadeOut(int start, int end, int red, int green, int blue, int steps)
int i,j,orig,delta; int i,j,orig,delta;
byte *origptr, *newptr; byte *origptr, *newptr;
VL_WaitVBL(1); VL_GetPalette(&palette1[0][0]);
VL_GetPalette (&palette1[0][0]); memcpy(palette2,palette1,768);
memcpy (palette2,palette1,768);
// //
// fade through intermediate frames // fade through intermediate frames
...@@ -267,9 +264,8 @@ void VL_FadeIn(int start, int end, byte *palette, int steps) ...@@ -267,9 +264,8 @@ void VL_FadeIn(int start, int end, byte *palette, int steps)
{ {
int i,j,delta; int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette (&palette1[0][0]); VL_GetPalette (&palette1[0][0]);
memcpy (&palette2[0][0],&palette1[0][0],sizeof(palette1)); memcpy(&palette2[0][0],&palette1[0][0],sizeof(palette1));
start *= 3; start *= 3;
end = end*3+2; end = end*3+2;
...@@ -292,6 +288,6 @@ void VL_FadeIn(int start, int end, byte *palette, int steps) ...@@ -292,6 +288,6 @@ void VL_FadeIn(int start, int end, byte *palette, int steps)
// //
// final color // final color
// //
VL_SetPalette (palette); VL_SetPalette(palette);
screenfaded = false; screenfaded = false;
} }
#include <sys/types.h> #include "id_heads.h"
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/time.h>
#include "misc.h"
static struct timeval t0; static struct timeval t0;
static long tc0; static long tc0;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
/* SDM = 2 */ /* SDM = 2 */
/* SOD = 3 */ /* SOD = 3 */
#ifndef WMODE #ifndef WMODE
#define WMODE 0 #define WMODE 3
#endif #endif
#if WMODE == 0 #if WMODE == 0
......
...@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) ...@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
char data[8] = { 0x01 }; char data[8] = { 0x01 };
char *disp, *ext; char *disp, *ext;
int attrmask, i; int attrmask;
int major, minor; int major, minor;
disp = getenv("DISPLAY"); disp = getenv("DISPLAY");
...@@ -237,8 +237,6 @@ void VL_ClearVideo(byte color) ...@@ -237,8 +237,6 @@ void VL_ClearVideo(byte color)
void VL_FillPalette(int red, int green, int blue) void VL_FillPalette(int red, int green, int blue)
{ {
int i;
} }
//=========================================================================== //===========================================================================
...@@ -253,11 +251,8 @@ void VL_FillPalette(int red, int green, int blue) ...@@ -253,11 +251,8 @@ void VL_FillPalette(int red, int green, int blue)
void VL_SetPalette(byte *palette) void VL_SetPalette(byte *palette)
{ {
int i;
} }
//=========================================================================== //===========================================================================
/* /*
...@@ -270,8 +265,6 @@ void VL_SetPalette(byte *palette) ...@@ -270,8 +265,6 @@ void VL_SetPalette(byte *palette)
void VL_GetPalette(byte *palette) void VL_GetPalette(byte *palette)
{ {
int i;
} }
/* /*
......
...@@ -35,11 +35,10 @@ int indexmode; ...@@ -35,11 +35,10 @@ int indexmode;
int shmmode; int shmmode;
unsigned char mypal[768]; unsigned char mypal[768];
Colormap GetVisual() void GetVisual()
{ {
XVisualInfo vitemp; XVisualInfo vitemp;
Colormap cmap;
int i, numVisuals; int i, numVisuals;
vitemp.screen = screen; vitemp.screen = screen;
...@@ -57,8 +56,8 @@ Colormap GetVisual() ...@@ -57,8 +56,8 @@ Colormap GetVisual()
clr[i].pixel = i; clr[i].pixel = i;
clr[i].flags = DoRed|DoGreen|DoBlue; clr[i].flags = DoRed|DoGreen|DoBlue;
} }
return cmap; return;
} }
vitemp.depth = 15; vitemp.depth = 15;
...@@ -72,13 +71,13 @@ Colormap GetVisual() ...@@ -72,13 +71,13 @@ Colormap GetVisual()
if (vi && (numVisuals > 0)) { if (vi && (numVisuals > 0)) {
indexmode = 0; indexmode = 0;
printf("15: rm:%04X gm:%04X bm:%04X cs:%04X bpr:%04X\n", vi->red_mask, printf("15: rm:%04lX gm:%04lX bm:%04lX cs:%04X bpr:%04X\n", vi->red_mask,
vi->green_mask, vi->blue_mask, vi->colormap_size, vi->green_mask, vi->blue_mask, vi->colormap_size,
vi->bits_per_rgb); vi->bits_per_rgb);
cmap = XCreateColormap(dpy, root, vi->visual, AllocNone); cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
return cmap; return;
} }
vitemp.depth = 16; vitemp.depth = 16;
...@@ -91,13 +90,13 @@ Colormap GetVisual() ...@@ -91,13 +90,13 @@ Colormap GetVisual()
if (vi && (numVisuals > 0)) { if (vi && (numVisuals > 0)) {
indexmode = 0; indexmode = 0;
printf("16: rm:%04X gm:%04X bm:%04X cs:%04X bpr:%04X\n", vi->red_mask, printf("16: rm:%04lX gm:%04lX bm:%04lX cs:%04X bpr:%04X\n", vi->red_mask,
vi->green_mask, vi->blue_mask, vi->colormap_size, vi->green_mask, vi->blue_mask, vi->colormap_size,
vi->bits_per_rgb); vi->bits_per_rgb);
cmap = XCreateColormap(dpy, root, vi->visual, AllocNone); cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
return cmap; return;
} }
vitemp.depth = 24; vitemp.depth = 24;
...@@ -110,13 +109,13 @@ Colormap GetVisual() ...@@ -110,13 +109,13 @@ Colormap GetVisual()
if (vi && (numVisuals > 0)) { if (vi && (numVisuals > 0)) {
indexmode = 0; indexmode = 0;
printf("24: rm:%04X gm:%04X bm:%04X cs:%04X bpr:%04X\n", vi->red_mask, printf("24: rm:%04lX gm:%04lX bm:%04lX cs:%04X bpr:%04X\n", vi->red_mask,
vi->green_mask, vi->blue_mask, vi->colormap_size, vi->green_mask, vi->blue_mask, vi->colormap_size,
vi->bits_per_rgb); vi->bits_per_rgb);
cmap = XCreateColormap(dpy, root, vi->visual, AllocNone); cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
return cmap; return;
} }
#if 0 #if 0
...@@ -129,18 +128,17 @@ Colormap GetVisual() ...@@ -129,18 +128,17 @@ Colormap GetVisual()
if (vi && (numVisuals > 0)) { if (vi && (numVisuals > 0)) {
indexmode = 0; indexmode = 0;
printf("32: rm:%04X gm:%04X bm:%04X cs:%04X bpr:%04X\n", vi->red_mask, printf("32: rm:%04lX gm:%04lX bm:%04lX cs:%04X bpr:%04X\n", vi->red_mask,
vi->green_mask, vi->blue_mask, vi->colormap_size, vi->green_mask, vi->blue_mask, vi->colormap_size,
vi->bits_per_rgb); vi->bits_per_rgb);
cmap = XCreateColormap(dpy, root, vi->visual, AllocNone); cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
return cmap; return;
} }
#endif
Quit("No usable visual found!");
#endif Quit("No usable visual found!");
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
...@@ -148,7 +146,6 @@ int main(int argc, char *argv[]) ...@@ -148,7 +146,6 @@ int main(int argc, char *argv[])
/* TODO: move these to proper functions */ /* TODO: move these to proper functions */
XSetWindowAttributes attr; XSetWindowAttributes attr;
XVisualInfo vitemp;
XSizeHints sizehints; XSizeHints sizehints;
XGCValues gcvalues; XGCValues gcvalues;
Pixmap bitmap; Pixmap bitmap;
...@@ -158,7 +155,7 @@ int main(int argc, char *argv[]) ...@@ -158,7 +155,7 @@ int main(int argc, char *argv[])
char data[8] = { 0x01 }; char data[8] = { 0x01 };
char *disp; char *disp;
int attrmask, numVisuals, i; int attrmask;
disp = getenv("DISPLAY"); disp = getenv("DISPLAY");
dpy = XOpenDisplay(disp); dpy = XOpenDisplay(disp);
...@@ -172,7 +169,7 @@ int main(int argc, char *argv[]) ...@@ -172,7 +169,7 @@ int main(int argc, char *argv[])
root = RootWindow(dpy, screen); root = RootWindow(dpy, screen);
cmap = GetVisual(); /* GetVisual will quit for us if no visual.. */ GetVisual(); /* GetVisual will quit for us if no visual.. */
attr.colormap = cmap; attr.colormap = cmap;
attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask; attr.event_mask = KeyPressMask | KeyReleaseMask | ExposureMask;
attrmask = CWColormap | CWEventMask; attrmask = CWColormap | CWEventMask;
...@@ -282,11 +279,13 @@ int BPP(int d) ...@@ -282,11 +279,13 @@ int BPP(int d)
case 16: case 16:
return 2; return 2;
case 24: /* TODO: ??? the nvidia xserver really gave me AGBR? */ case 24: /* TODO: ??? the nvidia xserver really gave me AGBR? */
/* need to check what the image says */
return 4; return 4;
case 32: case 32:
return 4; return 4;
default: default:
Quit("Sorry, BPP doesn't like that..."); Quit("Sorry, BPP doesn't like that...");
return 0; /* heh */
} }
} }
...@@ -304,7 +303,7 @@ void VL_Startup() ...@@ -304,7 +303,7 @@ void VL_Startup()
shminfo.shmid = shmget(IPC_PRIVATE, img->bytes_per_line * img->height, IPC_CREAT | 0777); shminfo.shmid = shmget(IPC_PRIVATE, img->bytes_per_line * img->height, IPC_CREAT | 0777);
shminfo.shmaddr = img->data = shmat(shminfo.shmid, 0, 0); shminfo.shmaddr = img->data = shmat(shminfo.shmid, 0, 0);
shminfo.readOnly = False; shminfo.readOnly = False;
disbuf = img->data; disbuf = (byte *)img->data;
if (indexmode) if (indexmode)
gfxbuf = disbuf; gfxbuf = disbuf;
......
...@@ -174,6 +174,8 @@ void SpawnStatic (int tilex, int tiley, int type) ...@@ -174,6 +174,8 @@ void SpawnStatic (int tilex, int tiley, int type)
laststatobj->flags = FL_BONUS; laststatobj->flags = FL_BONUS;
laststatobj->itemnumber = statinfo[type].type; laststatobj->itemnumber = statinfo[type].type;
break; break;
default:
break;
} }
laststatobj++; laststatobj++;
...@@ -614,7 +616,7 @@ void DoorOpening (int door) ...@@ -614,7 +616,7 @@ void DoorOpening (int door)
void DoorClosing (int door) void DoorClosing (int door)
{ {
int area1,area2,move; int area1,area2;
word *map; word *map;
long position; long position;
int tilex,tiley; int tilex,tiley;
...@@ -702,6 +704,8 @@ void MoveDoors (void) ...@@ -702,6 +704,8 @@ void MoveDoors (void)
case dr_closing: case dr_closing:
DoorClosing(door); DoorClosing(door);
break; break;
default:
break;
} }
} }
......
...@@ -15,17 +15,6 @@ ...@@ -15,17 +15,6 @@
#define BJRUNSPEED 2048 #define BJRUNSPEED 2048
#define BJJUMPSPEED 680 #define BJJUMPSPEED 680
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
/* /*
============================================================================= =============================================================================
...@@ -156,7 +145,6 @@ int starthitpoints[4][NUMENEMIES] = ...@@ -156,7 +145,6 @@ int starthitpoints[4][NUMENEMIES] =
void A_StartDeathCam (objtype *ob); void A_StartDeathCam (objtype *ob);
void T_Path (objtype *ob); void T_Path (objtype *ob);
void T_Shoot (objtype *ob); void T_Shoot (objtype *ob);
void T_Bite (objtype *ob); void T_Bite (objtype *ob);
...@@ -165,8 +153,6 @@ void T_Chase (objtype *ob); ...@@ -165,8 +153,6 @@ void T_Chase (objtype *ob);
void T_Projectile (objtype *ob); void T_Projectile (objtype *ob);
void T_Stand (objtype *ob); void T_Stand (objtype *ob);
void A_DeathScream (objtype *ob);
extern statetype s_rocket; extern statetype s_rocket;
extern statetype s_smoke1; extern statetype s_smoke1;
extern statetype s_smoke2; extern statetype s_smoke2;
...@@ -264,9 +250,8 @@ void A_Smoke (objtype *ob) ...@@ -264,9 +250,8 @@ void A_Smoke (objtype *ob)
boolean ProjectileTryMove (objtype *ob) boolean ProjectileTryMove (objtype *ob)
{ {
int xl,yl,xh,yh,x,y; int xl,yl,xh,yh,x,y;
objtype *check; objtype *check;
long deltax,deltay;
xl = (ob->x-PROJSIZE) >>TILESHIFT; xl = (ob->x-PROJSIZE) >>TILESHIFT;
yl = (ob->y-PROJSIZE) >>TILESHIFT; yl = (ob->y-PROJSIZE) >>TILESHIFT;
...@@ -274,9 +259,7 @@ boolean ProjectileTryMove (objtype *ob) ...@@ -274,9 +259,7 @@ boolean ProjectileTryMove (objtype *ob)
xh = (ob->x+PROJSIZE) >>TILESHIFT; xh = (ob->x+PROJSIZE) >>TILESHIFT;
yh = (ob->y+PROJSIZE) >>TILESHIFT; yh = (ob->y+PROJSIZE) >>TILESHIFT;
// /* check for solid walls */
// check for solid walls
//
for (y=yl;y<=yh;y++) for (y=yl;y<=yh;y++)
for (x=xl;x<=xh;x++) for (x=xl;x<=xh;x++)
{ {
...@@ -357,6 +340,8 @@ void T_Projectile (objtype *ob) ...@@ -357,6 +340,8 @@ void T_Projectile (objtype *ob)
case fireobj: case fireobj:
damage = (US_RndT() >>3); damage = (US_RndT() >>3);
break; break;
default:
break;
} }
TakeDamage (damage,ob); TakeDamage (damage,ob);
...@@ -878,6 +863,8 @@ void SpawnStand (enemy_t which, int tilex, int tiley, int dir) ...@@ -878,6 +863,8 @@ void SpawnStand (enemy_t which, int tilex, int tiley, int dir)
if (!loadedgame) if (!loadedgame)
gamestate.killtotal++; gamestate.killtotal++;
break; break;
default:
break;
} }
...@@ -936,8 +923,6 @@ void SpawnDeadGuard (int tilex, int tiley) ...@@ -936,8 +923,6 @@ void SpawnDeadGuard (int tilex, int tiley)
void SpawnBoss (int tilex, int tiley) void SpawnBoss (int tilex, int tiley)
{ {
word *map,tile;
SpawnNewObj (tilex,tiley,&s_bossstand); SpawnNewObj (tilex,tiley,&s_bossstand);
new->speed = SPDPATROL; new->speed = SPDPATROL;
...@@ -959,8 +944,6 @@ void SpawnBoss (int tilex, int tiley) ...@@ -959,8 +944,6 @@ void SpawnBoss (int tilex, int tiley)
void SpawnGretel (int tilex, int tiley) void SpawnGretel (int tilex, int tiley)
{ {
word *map,tile;
SpawnNewObj (tilex,tiley,&s_gretelstand); SpawnNewObj (tilex,tiley,&s_gretelstand);
new->speed = SPDPATROL; new->speed = SPDPATROL;
...@@ -1019,6 +1002,8 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir) ...@@ -1019,6 +1002,8 @@ void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir)
if (!loadedgame) if (!loadedgame)
gamestate.killtotal++; gamestate.killtotal++;
break; break;
default:
break;
} }
new->obclass = guardobj+which; new->obclass = guardobj+which;
...@@ -1078,6 +1063,8 @@ void A_DeathScream (objtype *ob) ...@@ -1078,6 +1063,8 @@ void A_DeathScream (objtype *ob)
case dogobj: case dogobj:
PlaySoundLocActor(DEATHSCREAM6SND,ob); PlaySoundLocActor(DEATHSCREAM6SND,ob);
return; return;
default:
break;
} }
} }
#endif #endif
...@@ -1162,6 +1149,8 @@ void A_DeathScream (objtype *ob) ...@@ -1162,6 +1149,8 @@ void A_DeathScream (objtype *ob)
SD_PlaySound(KNIGHTDEATHSND); SD_PlaySound(KNIGHTDEATHSND);
break; break;
#endif #endif
default:
break;
} }
} }
...@@ -1248,8 +1237,6 @@ statetype s_transshoot8 = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transchase1}; ...@@ -1248,8 +1237,6 @@ statetype s_transshoot8 = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transchase1};
void SpawnTrans (int tilex, int tiley) void SpawnTrans (int tilex, int tiley)
{ {
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off) if (SoundBlasterPresent && DigiMode != sds_Off)
s_transdie01.tictime = 105; s_transdie01.tictime = 105;
...@@ -1261,7 +1248,6 @@ void SpawnTrans (int tilex, int tiley) ...@@ -1261,7 +1248,6 @@ void SpawnTrans (int tilex, int tiley)
gamestate.killtotal++; gamestate.killtotal++;
} }
// //
// uber // uber
// //
...@@ -1329,8 +1315,6 @@ statetype s_ubershoot7 = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_uberchase1}; ...@@ -1329,8 +1315,6 @@ statetype s_ubershoot7 = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_uberchase1};
void SpawnUber (int tilex, int tiley) void SpawnUber (int tilex, int tiley)
{ {
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off) if (SoundBlasterPresent && DigiMode != sds_Off)
s_uberdie01.tictime = 70; s_uberdie01.tictime = 70;
...@@ -1342,7 +1326,6 @@ void SpawnUber (int tilex, int tiley) ...@@ -1342,7 +1326,6 @@ void SpawnUber (int tilex, int tiley)
gamestate.killtotal++; gamestate.killtotal++;
} }
/* /*
=============== ===============
= =
...@@ -1428,8 +1411,6 @@ statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1}; ...@@ -1428,8 +1411,6 @@ statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1};
void SpawnWill (int tilex, int tiley) void SpawnWill (int tilex, int tiley)
{ {
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off) if (SoundBlasterPresent && DigiMode != sds_Off)
s_willdie2.tictime = 70; s_willdie2.tictime = 70;
...@@ -1441,7 +1422,6 @@ void SpawnWill (int tilex, int tiley) ...@@ -1441,7 +1422,6 @@ void SpawnWill (int tilex, int tiley)
gamestate.killtotal++; gamestate.killtotal++;
} }
/* /*
================ ================
= =
...@@ -1603,8 +1583,6 @@ statetype s_deathshoot5 = {false,SPR_DEATH_SHOOT4,10,NULL,T_Shoot,&s_deathchase ...@@ -1603,8 +1583,6 @@ statetype s_deathshoot5 = {false,SPR_DEATH_SHOOT4,10,NULL,T_Shoot,&s_deathchase
void SpawnDeath (int tilex, int tiley) void SpawnDeath (int tilex, int tiley)
{ {
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off) if (SoundBlasterPresent && DigiMode != sds_Off)
s_deathdie2.tictime = 105; s_deathdie2.tictime = 105;
...@@ -1774,14 +1752,14 @@ statetype s_spark3 = {false,SPR_SPARK3,6,T_Projectile,NULL,&s_spark4}; ...@@ -1774,14 +1752,14 @@ statetype s_spark3 = {false,SPR_SPARK3,6,T_Projectile,NULL,&s_spark4};
statetype s_spark4 = {false,SPR_SPARK4,6,T_Projectile,NULL,&s_spark1}; statetype s_spark4 = {false,SPR_SPARK4,6,T_Projectile,NULL,&s_spark1};
void A_Slurpie (objtype *ob) void A_Slurpie(objtype *ob)
{ {
SD_PlaySound(SLURPIESND); SD_PlaySound(SLURPIESND);
} }
void A_Breathing (objtype *ob) void A_Breathing(objtype *ob)
{ {
SD_PlaySound(ANGELTIREDSND); SD_PlaySound(ANGELTIREDSND);
} }
/* /*
...@@ -1794,9 +1772,6 @@ void A_Breathing (objtype *ob) ...@@ -1794,9 +1772,6 @@ void A_Breathing (objtype *ob)
void SpawnAngel (int tilex, int tiley) void SpawnAngel (int tilex, int tiley)
{ {
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off) if (SoundBlasterPresent && DigiMode != sds_Off)
s_angeldie11.tictime = 105; s_angeldie11.tictime = 105;
...@@ -1912,8 +1887,6 @@ statetype s_spectrewake = {false,SPR_SPECTRE_F4,10,NULL,A_Dormant,&s_spectrewake ...@@ -1912,8 +1887,6 @@ statetype s_spectrewake = {false,SPR_SPECTRE_F4,10,NULL,A_Dormant,&s_spectrewake
void SpawnSpectre (int tilex, int tiley) void SpawnSpectre (int tilex, int tiley)
{ {
word *map,tile;
SpawnNewObj (tilex,tiley,&s_spectrewait1); SpawnNewObj (tilex,tiley,&s_spectrewait1);
new->obclass = spectreobj; new->obclass = spectreobj;
new->hitpoints = starthitpoints[gamestate.difficulty][en_spectre]; new->hitpoints = starthitpoints[gamestate.difficulty][en_spectre];
...@@ -1993,8 +1966,6 @@ moveok: ...@@ -1993,8 +1966,6 @@ moveok:
void SpawnGhosts (int which, int tilex, int tiley) void SpawnGhosts (int which, int tilex, int tiley)
{ {
word *map,tile;
switch(which) switch(which)
{ {
case en_blinky: case en_blinky:
...@@ -2020,8 +1991,6 @@ void SpawnGhosts (int which, int tilex, int tiley) ...@@ -2020,8 +1991,6 @@ void SpawnGhosts (int which, int tilex, int tiley)
gamestate.killtotal++; gamestate.killtotal++;
} }
void T_Gift (objtype *ob); void T_Gift (objtype *ob);
void T_GiftThrow (objtype *ob); void T_GiftThrow (objtype *ob);
...@@ -2209,11 +2178,9 @@ statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatchase1}; ...@@ -2209,11 +2178,9 @@ statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatchase1};
=============== ===============
*/ */
void SpawnSchabbs (int tilex, int tiley) void SpawnSchabbs(int tilex, int tiley)
{ {
word *map,tile; if (DigiMode != sds_Off) /* TODO: what? */
if (DigiMode != sds_Off)
s_schabbdie2.tictime = 140; s_schabbdie2.tictime = 140;
else else
s_schabbdie2.tictime = 5; s_schabbdie2.tictime = 5;
...@@ -2240,8 +2207,6 @@ void SpawnSchabbs (int tilex, int tiley) ...@@ -2240,8 +2207,6 @@ void SpawnSchabbs (int tilex, int tiley)
void SpawnGift (int tilex, int tiley) void SpawnGift (int tilex, int tiley)
{ {
word *map,tile;
if (DigiMode != sds_Off) if (DigiMode != sds_Off)
s_giftdie2.tictime = 140; s_giftdie2.tictime = 140;
else else
...@@ -2269,8 +2234,6 @@ void SpawnGift (int tilex, int tiley) ...@@ -2269,8 +2234,6 @@ void SpawnGift (int tilex, int tiley)
void SpawnFat (int tilex, int tiley) void SpawnFat (int tilex, int tiley)
{ {
word *map,tile;
if (DigiMode != sds_Off) if (DigiMode != sds_Off)
s_fatdie2.tictime = 140; s_fatdie2.tictime = 140;
else else
...@@ -2829,9 +2792,6 @@ statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlerch ...@@ -2829,9 +2792,6 @@ statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlerch
void SpawnFakeHitler (int tilex, int tiley) void SpawnFakeHitler (int tilex, int tiley)
{ {
word *map,tile;
if (DigiMode != sds_Off) if (DigiMode != sds_Off)
s_hitlerdie2.tictime = 140; s_hitlerdie2.tictime = 140;
else else
...@@ -2859,8 +2819,6 @@ void SpawnFakeHitler (int tilex, int tiley) ...@@ -2859,8 +2819,6 @@ void SpawnFakeHitler (int tilex, int tiley)
void SpawnHitler (int tilex, int tiley) void SpawnHitler (int tilex, int tiley)
{ {
word *map,tile;
if (DigiMode != sds_Off) if (DigiMode != sds_Off)
s_hitlerdie2.tictime = 140; s_hitlerdie2.tictime = 140;
else else
...@@ -2889,8 +2847,7 @@ void SpawnHitler (int tilex, int tiley) ...@@ -2889,8 +2847,7 @@ void SpawnHitler (int tilex, int tiley)
void A_HitlerMorph (objtype *ob) void A_HitlerMorph (objtype *ob)
{ {
word *map,tile,hitpoints[4]={500,700,800,900}; word hitpoints[4]={500,700,800,900};
SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1); SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1);
new->speed = SPDPATROL*5; new->speed = SPDPATROL*5;
...@@ -2979,8 +2936,6 @@ void T_FakeFire (objtype *ob) ...@@ -2979,8 +2936,6 @@ void T_FakeFire (objtype *ob)
void T_Fake (objtype *ob) void T_Fake (objtype *ob)
{ {
long move; long move;
int dx,dy,dist;
boolean dodge;
if (CheckLine(ob)) // got a shot at player? if (CheckLine(ob)) // got a shot at player?
{ {
...@@ -3140,6 +3095,8 @@ void T_Chase (objtype *ob) ...@@ -3140,6 +3095,8 @@ void T_Chase (objtype *ob)
NewState (ob,&s_deathshoot1); NewState (ob,&s_deathshoot1);
break; break;
#endif #endif
default:
break;
} }
return; return;
} }
...@@ -3262,7 +3219,6 @@ void T_Ghosts (objtype *ob) ...@@ -3262,7 +3219,6 @@ void T_Ghosts (objtype *ob)
void T_DogChase (objtype *ob) void T_DogChase (objtype *ob)
{ {
long move; long move;
int dist,chance;
long dx,dy; long dx,dy;
...@@ -3372,7 +3328,6 @@ void SelectPathDir (objtype *ob) ...@@ -3372,7 +3328,6 @@ void SelectPathDir (objtype *ob)
void T_Path (objtype *ob) void T_Path (objtype *ob)
{ {
long move; long move;
long deltax,deltay,size;
if (SightPlayer (ob)) if (SightPlayer (ob))
return; return;
...@@ -3422,7 +3377,7 @@ void T_Path (objtype *ob) ...@@ -3422,7 +3377,7 @@ void T_Path (objtype *ob)
SelectPathDir (ob); SelectPathDir (ob);
if (ob->dir == nodir) if (ob->dir == nodir)
return; // all movement is blocked return; /* all movement is blocked */
} }
} }
...@@ -3539,8 +3494,6 @@ void T_Shoot (objtype *ob) ...@@ -3539,8 +3494,6 @@ void T_Shoot (objtype *ob)
void T_Bite (objtype *ob) void T_Bite (objtype *ob)
{ {
long dx,dy; long dx,dy;
int hitchance,damage;
PlaySoundLocActor(DOGATTACKSND,ob); // JAB PlaySoundLocActor(DOGATTACKSND,ob); // JAB
...@@ -3629,8 +3582,6 @@ statetype s_deathcam = {false,0,0,NULL,NULL,NULL}; ...@@ -3629,8 +3582,6 @@ statetype s_deathcam = {false,0,0,NULL,NULL,NULL};
void SpawnBJVictory (void) void SpawnBJVictory (void)
{ {
word *map,tile;
SpawnNewObj (player->tilex,player->tiley+1,&s_bjrun1); SpawnNewObj (player->tilex,player->tiley+1,&s_bjrun1);
new->x = player->x; new->x = player->x;
new->y = player->y; new->y = player->y;
...@@ -3776,7 +3727,6 @@ void A_StartDeathCam (objtype *ob) ...@@ -3776,7 +3727,6 @@ void A_StartDeathCam (objtype *ob)
float fangle; float fangle;
long xmove,ymove; long xmove,ymove;
long dist; long dist;
int temp,i;
FinishPaletteShifts (); FinishPaletteShifts ();
...@@ -3795,7 +3745,6 @@ void A_StartDeathCam (objtype *ob) ...@@ -3795,7 +3745,6 @@ void A_StartDeathCam (objtype *ob)
CA_UpLevel (); CA_UpLevel ();
CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);
/* TODO: does this also show the deathcam sprite? */
Write(0,7,STR_SEEAGAIN); Write(0,7,STR_SEEAGAIN);
CA_DownLevel (); CA_DownLevel ();
...@@ -3861,7 +3810,9 @@ void A_StartDeathCam (objtype *ob) ...@@ -3861,7 +3810,9 @@ void A_StartDeathCam (objtype *ob)
case fatobj: case fatobj:
NewState (ob,&s_fatdeathcam); NewState (ob,&s_fatdeathcam);
break; break;
#endif #endif
default:
break;
} }
} }
......
...@@ -63,20 +63,10 @@ struct atkinf ...@@ -63,20 +63,10 @@ struct atkinf
void DrawWeapon (void); void DrawWeapon (void);
void GiveWeapon (int weapon); void GiveWeapon (int weapon);
void GiveAmmo (int ammo); void GiveAmmo (int ammo);
//=========================================================================== //===========================================================================
//----------
void Attack (void);
void Use (void);
void Search (objtype *ob);
void SelectWeapon (void);
void SelectItem (void);
//----------
boolean TryMove (objtype *ob); boolean TryMove (objtype *ob);
void T_Player (objtype *ob); void T_Player (objtype *ob);
...@@ -102,7 +92,7 @@ void ClipMove (objtype *ob, long xmove, long ymove); ...@@ -102,7 +92,7 @@ void ClipMove (objtype *ob, long xmove, long ymove);
void CheckWeaponChange (void) void CheckWeaponChange (void)
{ {
int i,buttons; int i;
if (!gamestate.ammo) // must use knife with no ammo if (!gamestate.ammo) // must use knife with no ammo
return; return;
...@@ -134,9 +124,8 @@ void CheckWeaponChange (void) ...@@ -134,9 +124,8 @@ void CheckWeaponChange (void)
void ControlMovement (objtype *ob) void ControlMovement (objtype *ob)
{ {
int angle,maxxmove; int angle;
int angleunits; int angleunits;
long speed;
thrustspeed = 0; thrustspeed = 0;
// //
...@@ -162,9 +151,7 @@ void ControlMovement (objtype *ob) ...@@ -162,9 +151,7 @@ void ControlMovement (objtype *ob)
angle -= ANGLES; angle -= ANGLES;
Thrust (angle,-controlx*MOVESCALE); // move to right Thrust (angle,-controlx*MOVESCALE); // move to right
} }
} } else {
else
{
// //
// not strafing // not strafing
// //
...@@ -216,14 +203,9 @@ void ControlMovement (objtype *ob) ...@@ -216,14 +203,9 @@ void ControlMovement (objtype *ob)
================== ==================
*/ */
void StatusDrawPic (unsigned x, unsigned y, unsigned picnum) void StatusDrawPic(unsigned x, unsigned y, unsigned picnum)
{ {
/* TODO hmm */
LatchDrawPic (x,y,picnum); LatchDrawPic (x,y,picnum);
/*
LatchDrawPic (x,y,picnum);
LatchDrawPic (x,y,picnum);
*/
} }
...@@ -972,13 +954,11 @@ void Cmd_Fire (void) ...@@ -972,13 +954,11 @@ void Cmd_Fire (void)
=============== ===============
*/ */
void Cmd_Use (void) void Cmd_Use()
{ {
objtype *check;
int checkx,checky,doornum,dir; int checkx,checky,doornum,dir;
boolean elevatorok; boolean elevatorok;
// //
// find which cardinal direction the player is facing // find which cardinal direction the player is facing
// //
...@@ -1150,6 +1130,8 @@ void GunAttack (objtype *ob) ...@@ -1150,6 +1130,8 @@ void GunAttack (objtype *ob)
case wp_chaingun: case wp_chaingun:
SD_PlaySound (ATKGATLINGSND); SD_PlaySound (ATKGATLINGSND);
break; break;
default:
break;
} }
madenoise = true; madenoise = true;
......
...@@ -2,45 +2,6 @@ ...@@ -2,45 +2,6 @@
#include "wl_def.h" #include "wl_def.h"
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
#define VIEWTILEX (viewwidth/16)
#define VIEWTILEY (viewheight/16)
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
int DebugKeys (void);
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
int maporgx;
int maporgy;
enum {mapview,tilemapview,actoratview,visview} viewtype;
void ViewMap (void);
//===========================================================================
/* /*
================== ==================
= =
...@@ -102,26 +63,16 @@ void CountObjects (void) ...@@ -102,26 +63,16 @@ void CountObjects (void)
void PicturePause (void) void PicturePause (void)
{ {
int i;
byte p;
unsigned x;
byte *dest, *src;
memptr buffer;
FinishPaletteShifts (); FinishPaletteShifts ();
LastScan = 0; IN_Ack();
while (!LastScan)
;
if (LastScan != sc_Enter) if (LastScan != sc_Enter)
{ {
return; return;
} }
//
// vga stuff...
//
/* TODO: save picture to file */ /* TODO: save picture to file */
VL_SetPalette(gamepal); VL_SetPalette(gamepal);
...@@ -326,7 +277,7 @@ static char buf[10]; ...@@ -326,7 +277,7 @@ static char buf[10];
int DebugKeys() int DebugKeys()
{ {
boolean esc; boolean esc;
int level,i; int level;
if (Keyboard[sc_C]) // C = count objects if (Keyboard[sc_C]) // C = count objects
{ {
...@@ -399,13 +350,6 @@ int DebugKeys() ...@@ -399,13 +350,6 @@ int DebugKeys()
IN_Ack (); IN_Ack ();
return 1; return 1;
} }
#if 0
else if (Keyboard[sc_O]) // O = overhead
{
ViewMap();
return 1;
}
#endif
else if (Keyboard[sc_P]) // P = pause with no screen disruptioon else if (Keyboard[sc_P]) // P = pause with no screen disruptioon
{ {
PicturePause (); PicturePause ();
...@@ -452,6 +396,8 @@ int DebugKeys() ...@@ -452,6 +396,8 @@ int DebugKeys()
/* TODO: wouldn't work on sod demo etc */ /* TODO: wouldn't work on sod demo etc */
#ifndef SPEAR #ifndef SPEAR
US_Print(" Warp to which level(1-10):"); US_Print(" Warp to which level(1-10):");
#elif defined(SPEARDEMO)
US_Print(" Warp to which level(1-2):");
#else #else
US_Print(" Warp to which level(1-21):"); US_Print(" Warp to which level(1-21):");
#endif #endif
...@@ -462,6 +408,8 @@ int DebugKeys() ...@@ -462,6 +408,8 @@ int DebugKeys()
level = atoi (str); level = atoi (str);
#ifndef SPEAR #ifndef SPEAR
if (level>0 && level<11) if (level>0 && level<11)
#elif defined(SPEARDEMO)
if (level>0 && level<2)
#else #else
if (level>0 && level<22) if (level>0 && level<22)
#endif #endif
...@@ -475,128 +423,3 @@ int DebugKeys() ...@@ -475,128 +423,3 @@ int DebugKeys()
return 0; return 0;
} }
#if 0
/*
===================
=
= OverheadRefresh
=
===================
*/
void OverheadRefresh (void)
{
unsigned x,y,endx,endy,sx,sy;
unsigned tile;
endx = maporgx+VIEWTILEX;
endy = maporgy+VIEWTILEY;
for (y=maporgy;y<endy;y++)
for (x=maporgx;x<endx;x++)
{
sx = (x-maporgx)*16;
sy = (y-maporgy)*16;
switch (viewtype)
{
#if 0
case mapview:
tile = *(mapsegs[0]+farmapylookup[y]+x);
break;
case tilemapview:
tile = tilemap[x][y];
break;
case visview:
tile = spotvis[x][y];
break;
#endif
case actoratview:
tile = (unsigned)actorat[x][y];
break;
}
#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0]+(p)*16,2,8,x,y)
#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1]+(p)*64,4,16,x,y)
if (tile<MAXWALLTILES)
LatchDrawTile(sx,sy,tile);
else
{
LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
}
}
}
#endif
#if 0
/*
===================
=
= ViewMap
=
===================
*/
void ViewMap (void)
{
boolean button0held;
viewtype = actoratview;
// button0held = false;
maporgx = player->tilex - VIEWTILEX/2;
if (maporgx<0)
maporgx = 0;
if (maporgx>MAPSIZE-VIEWTILEX)
maporgx=MAPSIZE-VIEWTILEX;
maporgy = player->tiley - VIEWTILEY/2;
if (maporgy<0)
maporgy = 0;
if (maporgy>MAPSIZE-VIEWTILEY)
maporgy=MAPSIZE-VIEWTILEY;
do
{
//
// let user pan around
//
PollControls ();
if (controlx < 0 && maporgx>0)
maporgx--;
if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
maporgx++;
if (controly < 0 && maporgy>0)
maporgy--;
if (controly > 0 && maporgy<mapheight-VIEWTILEY)
maporgy++;
#if 0
if (c.button0 && !button0held)
{
button0held = true;
viewtype++;
if (viewtype>visview)
viewtype = mapview;
}
if (!c.button0)
button0held = false;
#endif
OverheadRefresh ();
} while (!Keyboard[sc_Escape]);
IN_ClearKeysDown ();
}
#endif
...@@ -49,9 +49,6 @@ ...@@ -49,9 +49,6 @@
#define AMBUSHTILE 106 #define AMBUSHTILE 106
#define ALTELEVATORTILE 107 #define ALTELEVATORTILE 107
#define NUMBERCHARS 9
#define HEIGHTRATIO 0.50 #define HEIGHTRATIO 0.50
//---------------- //----------------
...@@ -60,8 +57,6 @@ ...@@ -60,8 +57,6 @@
#define RUNSPEED 6000 #define RUNSPEED 6000
#define SCREENBWIDE 80
#define PLAYERSIZE MINDIST // player radius #define PLAYERSIZE MINDIST // player radius
#define MINACTORDIST 0x10000l // minimum dist from player center #define MINACTORDIST 0x10000l // minimum dist from player center
// to any actor center // to any actor center
...@@ -636,7 +631,7 @@ enum { ...@@ -636,7 +631,7 @@ enum {
}; };
#define NUMWEAPONS 5 #define NUMWEAPONS 4
typedef enum { typedef enum {
wp_knife, wp_knife,
wp_pistol, wp_pistol,
...@@ -832,6 +827,7 @@ extern char *demoptr, *lastdemoptr; ...@@ -832,6 +827,7 @@ extern char *demoptr, *lastdemoptr;
extern memptr demobuffer; extern memptr demobuffer;
void StatusDrawPic(unsigned x, unsigned y, unsigned picnum);
void InitRedShifts (void); void InitRedShifts (void);
void FinishPaletteShifts (void); void FinishPaletteShifts (void);
...@@ -1114,6 +1110,10 @@ extern statetype s_hitlerdeathcam2; ...@@ -1114,6 +1110,10 @@ extern statetype s_hitlerdeathcam2;
extern statetype s_giftdeathcam2; extern statetype s_giftdeathcam2;
extern statetype s_fatdeathcam2; extern statetype s_fatdeathcam2;
void A_DeathScream(objtype *ob);
void SpawnBJVictory(void);
void SpawnStand (enemy_t which, int tilex, int tiley, int dir); void SpawnStand (enemy_t which, int tilex, int tiley, int dir);
void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir); void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir);
void KillActor (objtype *ob); void KillActor (objtype *ob);
......
...@@ -42,6 +42,7 @@ long xstep,ystep; ...@@ -42,6 +42,7 @@ long xstep,ystep;
extern unsigned xoffset, yoffset; extern unsigned xoffset, yoffset;
void AsmRefresh (void); void AsmRefresh (void);
void xBuildCompScale(int height, byte *source, int x);
//========================================================================== //==========================================================================
...@@ -709,9 +710,7 @@ void AsmRefresh (void) ...@@ -709,9 +710,7 @@ void AsmRefresh (void)
for (pixx = 0; pixx < viewwidth; pixx++) { for (pixx = 0; pixx < viewwidth; pixx++) {
angle = midangle + pixelangle[pixx]; angle = midangle + pixelangle[pixx];
#ifdef DEBUGx
printf ("tracing angle = %d\n", angle);
#endif
if (angle < 0) { if (angle < 0) {
/* -90 - -1 degree arc */ /* -90 - -1 degree arc */
angle += FINEANGLES; angle += FINEANGLES;
...@@ -755,16 +754,12 @@ void AsmRefresh (void) ...@@ -755,16 +754,12 @@ void AsmRefresh (void)
goto entry90; goto entry90;
} }
initvars:
yintercept = viewy + xpartialbyystep (); yintercept = viewy + xpartialbyystep ();
xtile = focaltx + xtilestep; xtile = focaltx + xtilestep;
xintercept = viewx + ypartialbyxstep (); xintercept = viewx + ypartialbyxstep ();
ytile = focalty + ytilestep; ytile = focalty + ytilestep;
#ifdef DEBUGx
printf ("xintercept = %d, ytile = %d\n", xintercept, ytile);
printf ("xtile = %d, yintercept = %d\n", xtile, yintercept);
#endif
/* CORE LOOP */ /* CORE LOOP */
#define TILE(n) (n>>16) #define TILE(n) (n>>16)
...@@ -775,9 +770,7 @@ void AsmRefresh (void) ...@@ -775,9 +770,7 @@ void AsmRefresh (void)
goto horizentry; goto horizentry;
vertentry: vertentry:
tilehit = tilemap [xtile][TILE(yintercept)]; tilehit = tilemap [xtile][TILE(yintercept)];
#if DEBUGx
printf ("vert: %d %x %d, %d\n", pixx, tilehit, xtile, TILE(yintercept));
#endif
if (tilehit != 0) { if (tilehit != 0) {
if (tilehit & 0x80) { if (tilehit & 0x80) {
if (tilehit & 0x40) { if (tilehit & 0x40) {
...@@ -820,9 +813,7 @@ void AsmRefresh (void) ...@@ -820,9 +813,7 @@ void AsmRefresh (void)
goto vertentry; goto vertentry;
horizentry: horizentry:
tilehit = tilemap [TILE(xintercept)][ytile]; tilehit = tilemap [TILE(xintercept)][ytile];
#if DEBUGx
printf ("horiz: %d %x %d, %d\n", pixx, tilehit, TILE(xintercept), ytile);
#endif
if (tilehit != 0) { if (tilehit != 0) {
if (tilehit & 0x80) { if (tilehit & 0x80) {
/* horizdoor */ /* horizdoor */
...@@ -870,10 +861,6 @@ void HitVertWall (void) ...@@ -870,10 +861,6 @@ void HitVertWall (void)
unsigned texture; unsigned texture;
byte *wall; byte *wall;
#ifdef DEBUGx
printf ("HitVertWall: xtile = %d, TILE(yintercept) = %d\n",
xtile, TILE(yintercept));
#endif
texture = (yintercept>>4)&0xfc0; texture = (yintercept>>4)&0xfc0;
if (xtilestep == -1) if (xtilestep == -1)
{ {
...@@ -906,10 +893,6 @@ void HitHorizWall (void) ...@@ -906,10 +893,6 @@ void HitHorizWall (void)
unsigned texture; unsigned texture;
byte *wall; byte *wall;
#ifdef DEBUGx
printf ("HitHorizWall: ytile = %d, TILE(xintercept) = %d\n",
ytile, TILE(xintercept));
#endif
texture = (xintercept>>4)&0xfc0; texture = (xintercept>>4)&0xfc0;
if (ytilestep == -1) if (ytilestep == -1)
yintercept += TILEGLOBAL; yintercept += TILEGLOBAL;
......
...@@ -182,9 +182,9 @@ void ClearMemory (void) ...@@ -182,9 +182,9 @@ void ClearMemory (void)
void ScanInfoPlane (void) void ScanInfoPlane (void)
{ {
unsigned x,y,i,j; unsigned x,y;
int tile; int tile;
word *start; word *start;
start = mapsegs[1]; start = mapsegs[1];
for (y=0;y<mapheight;y++) for (y=0;y<mapheight;y++)
...@@ -586,9 +586,8 @@ void ScanInfoPlane (void) ...@@ -586,9 +586,8 @@ void ScanInfoPlane (void)
void SetupGameLevel (void) void SetupGameLevel (void)
{ {
int x,y,i; int x,y;
word *map,tile,spot; word *map,tile;
if (!loadedgame) if (!loadedgame)
{ {
...@@ -641,7 +640,7 @@ void SetupGameLevel (void) ...@@ -641,7 +640,7 @@ void SetupGameLevel (void)
// //
// spawn doors // spawn doors
// //
InitActorList(); // start spawning things with a clean slate InitActorList(); /* start spawning things with a clean slate */
InitDoorList(); InitDoorList();
InitStaticList(); InitStaticList();
...@@ -806,10 +805,8 @@ void DrawPlayBorder (void) ...@@ -806,10 +805,8 @@ void DrawPlayBorder (void)
=================== ===================
*/ */
void DrawPlayScreen (void) void DrawPlayScreen()
{ {
int i,j,p,m;
VW_FadeOut (); VW_FadeOut ();
CA_CacheGrChunk(STATUSBARPIC); CA_CacheGrChunk(STATUSBARPIC);
...@@ -819,14 +816,14 @@ void DrawPlayScreen (void) ...@@ -819,14 +816,14 @@ void DrawPlayScreen (void)
CA_UnCacheGrChunk(STATUSBARPIC); CA_UnCacheGrChunk(STATUSBARPIC);
DrawFace (); DrawFace();
DrawHealth (); DrawHealth();
DrawLives (); DrawLives();
DrawLevel (); DrawLevel();
DrawAmmo (); DrawAmmo();
DrawKeys (); DrawKeys();
DrawWeapon (); DrawWeapon();
DrawScore (); DrawScore();
} }
...@@ -1208,10 +1205,8 @@ void Died() ...@@ -1208,10 +1205,8 @@ void Died()
=================== ===================
*/ */
void GameLoop (void) void GameLoop()
{ {
int i,xl,yl,xh,yh;
char num[20];
boolean died; boolean died;
restartgame: restartgame:
...@@ -1219,7 +1214,7 @@ restartgame: ...@@ -1219,7 +1214,7 @@ restartgame:
SETFONTCOLOR(0,15); SETFONTCOLOR(0,15);
DrawPlayScreen (); DrawPlayScreen ();
died = false; died = false;
restart:
do do
{ {
if (!loadedgame) if (!loadedgame)
...@@ -1250,7 +1245,9 @@ restart: ...@@ -1250,7 +1245,9 @@ restart:
fizzlein = true; fizzlein = true;
DrawLevel (); DrawLevel ();
#ifdef SPEAR
startplayloop: startplayloop:
#endif
PlayLoop (); PlayLoop ();
#ifdef SPEAR #ifdef SPEAR
......
...@@ -323,7 +323,7 @@ void Write(int x,int y,char *string) ...@@ -323,7 +323,7 @@ void Write(int x,int y,char *string)
break; break;
default: default:
VWB_DrawPic(nx,ny,alpha[ch]); VWB_DrawPic(nx,ny,alpha[(int)ch]);
} }
nx+=16; nx+=16;
} }
...@@ -369,7 +369,7 @@ LRstruct LevelRatios[8]; ...@@ -369,7 +369,7 @@ LRstruct LevelRatios[8];
LRstruct LevelRatios[20]; LRstruct LevelRatios[20];
#endif #endif
void LevelCompleted (void) void LevelCompleted()
{ {
#define VBLWAIT 30 #define VBLWAIT 30
#define PAR_AMOUNT 500 #define PAR_AMOUNT 500
...@@ -380,7 +380,7 @@ void LevelCompleted (void) ...@@ -380,7 +380,7 @@ void LevelCompleted (void)
} times; } times;
int x,i,min,sec,ratio,kr,sr,tr; int x,i,min,sec,ratio,kr,sr,tr;
unsigned temp;
char tempstr[10]; char tempstr[10];
long bonus,timeleft=0; long bonus,timeleft=0;
times parTimes[]= times parTimes[]=
...@@ -908,16 +908,12 @@ void PreloadGraphics() ...@@ -908,16 +908,12 @@ void PreloadGraphics()
================== ==================
*/ */
void DrawHighScores(void) void DrawHighScores()
{ {
char buffer[16],*str,buffer1[5]; char buffer[16],*str,buffer1[5];
byte temp,temp1,temp2,temp3; word i,w,h;
word i,j,
w,h,
x,y;
HighScore *s; HighScore *s;
MM_SortMem (); MM_SortMem ();
#ifndef SPEAR #ifndef SPEAR
...@@ -1019,36 +1015,6 @@ void DrawHighScores(void) ...@@ -1019,36 +1015,6 @@ void DrawHighScores(void)
#endif #endif
US_Print(buffer); US_Print(buffer);
#if 0
#ifndef UPLOAD
#ifndef SPEAR
//
// verification #
//
if (!i)
{
temp=(((s->score >> 28)& 0xf)^
((s->score >> 24)& 0xf))+'A';
temp1=(((s->score >> 20)& 0xf)^
((s->score >> 16)& 0xf))+'A';
temp2=(((s->score >> 12)& 0xf)^
((s->score >> 8)& 0xf))+'A';
temp3=(((s->score >> 4)& 0xf)^
((s->score >> 0)& 0xf))+'A';
SETFONTCOLOR(0x49,0x29);
PrintX = 35*8;
buffer[0]=temp;
buffer[1]=temp1;
buffer[2]=temp2;
buffer[3]=temp3;
buffer[4]=0;
US_Print(buffer);
SETFONTCOLOR(15,0x29);
}
#endif
#endif
#endif
} }
VW_UpdateScreen (); VW_UpdateScreen ();
......
...@@ -1096,10 +1096,6 @@ void InitGame(void) ...@@ -1096,10 +1096,6 @@ void InitGame(void)
DoJukebox(); DoJukebox();
else else
#endif #endif
//
// draw intro screen stuff
//
IntroScreen ();
// //
// load in and lock down some basic chunks // load in and lock down some basic chunks
......
...@@ -232,7 +232,7 @@ static byte ...@@ -232,7 +232,7 @@ static byte
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void US_ControlPanel(byte scancode) void US_ControlPanel(byte scancode)
{ {
int which,i,start; int which;
if (ingame) if (ingame)
if (CP_CheckQuick(scancode)) if (CP_CheckQuick(scancode))
...@@ -360,6 +360,7 @@ void US_ControlPanel(byte scancode) ...@@ -360,6 +360,7 @@ void US_ControlPanel(byte scancode)
#ifdef SPEAR #ifdef SPEAR
if (!ingame) if (!ingame)
{ {
int start, i;
// //
// DEALLOCATE ALL SOUNDS! // DEALLOCATE ALL SOUNDS!
// //
...@@ -371,6 +372,8 @@ void US_ControlPanel(byte scancode) ...@@ -371,6 +372,8 @@ void US_ControlPanel(byte scancode)
case sdm_AdLib: case sdm_AdLib:
start = STARTADLIBSOUNDS; start = STARTADLIBSOUNDS;
break; break;
default:
break;
} }
if (SoundMode != sdm_Off) if (SoundMode != sdm_Off)
...@@ -927,8 +930,7 @@ void DrawNewGameDiff(int w) ...@@ -927,8 +930,7 @@ void DrawNewGameDiff(int w)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CP_Sound(void) void CP_Sound(void)
{ {
int which,i; int which;
#ifdef SPEAR #ifdef SPEAR
UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END); UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
...@@ -1529,10 +1531,8 @@ int CalibrateJoystick(void) ...@@ -1529,10 +1531,8 @@ int CalibrateJoystick(void)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CP_Control(void) void CP_Control(void)
{ {
#define CTL_SPC 70
enum {MOUSEENABLE,JOYENABLE,USEPORT2,PADENABLE,MOUSESENS,CUSTOMIZE}; enum {MOUSEENABLE,JOYENABLE,USEPORT2,PADENABLE,MOUSESENS,CUSTOMIZE};
int i,which; int which;
#ifdef SPEAR #ifdef SPEAR
UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END); UnCacheLump (OPTIONS_LUMP_START,OPTIONS_LUMP_END);
...@@ -2095,6 +2095,8 @@ void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*Print ...@@ -2095,6 +2095,8 @@ void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*Print
case dir_North: case dir_North:
case dir_South: case dir_South:
exit=1; exit=1;
default:
break;
} }
} while(!exit); } while(!exit);
...@@ -2452,6 +2454,8 @@ void CP_ChangeView(void) ...@@ -2452,6 +2454,8 @@ void CP_ChangeView(void)
SD_PlaySound(HITWALLSND); SD_PlaySound(HITWALLSND);
TicDelay(10); TicDelay(10);
break; break;
default:
break;
} }
if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode")) if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("debugmode"))
...@@ -2514,9 +2518,6 @@ void DrawChangeView(int view) ...@@ -2514,9 +2518,6 @@ void DrawChangeView(int view)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CP_Quit(void) void CP_Quit(void)
{ {
int i;
if (Confirm(endStrings[(US_RndT()&0x7)+(US_RndT()&1)])) if (Confirm(endStrings[(US_RndT()&0x7)+(US_RndT()&1)]))
{ {
VW_UpdateScreen(); VW_UpdateScreen();
...@@ -2529,17 +2530,6 @@ void CP_Quit(void) ...@@ -2529,17 +2530,6 @@ void CP_Quit(void)
DrawMainMenu(); DrawMainMenu();
} }
////////////////////////////////////////////////////////////////////
//
// HANDLE INTRO SCREEN (SYSTEM CONFIG)
//
////////////////////////////////////////////////////////////////////
void IntroScreen(void)
{
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// //
...@@ -2568,22 +2558,21 @@ void ClearMScreen(void) ...@@ -2568,22 +2558,21 @@ void ClearMScreen(void)
// Un/Cache a LUMP of graphics // Un/Cache a LUMP of graphics
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CacheLump(int lumpstart,int lumpend) void CacheLump(int lumpstart, int lumpend)
{ {
int i; int i;
for (i=lumpstart;i<=lumpend;i++) for (i=lumpstart;i<=lumpend;i++)
CA_CacheGrChunk(i); CA_CacheGrChunk(i);
} }
void UnCacheLump(int lumpstart,int lumpend) void UnCacheLump(int lumpstart, int lumpend)
{ {
int i; int i;
for (i=lumpstart;i<=lumpend;i++) for (i=lumpstart;i<=lumpend;i++)
if (grsegs[i]) CA_UnCacheGrChunk(i);
UNCACHEGRCHUNK(i);
} }
...@@ -2598,7 +2587,6 @@ void DrawWindow(int x,int y,int w,int h,int wcolor) ...@@ -2598,7 +2587,6 @@ void DrawWindow(int x,int y,int w,int h,int wcolor)
DrawOutline(x,y,w,h,BORD2COLOR,DEACTIVE); DrawOutline(x,y,w,h,BORD2COLOR,DEACTIVE);
} }
void DrawOutline(int x,int y,int w,int h,int color1,int color2) void DrawOutline(int x,int y,int w,int h,int color1,int color2)
{ {
VWB_Hlin(x,x+w,y,color2); VWB_Hlin(x,x+w,y,color2);
...@@ -2617,9 +2605,7 @@ void SetupControlPanel(void) ...@@ -2617,9 +2605,7 @@ void SetupControlPanel(void)
{ {
#if 0 /* DOS VERSION */ #if 0 /* DOS VERSION */
struct ffblk f; struct ffblk f;
char name[13]; int which;
int which,i;
// //
// CACHE GRAPHICS & SOUNDS // CACHE GRAPHICS & SOUNDS
...@@ -2662,8 +2648,7 @@ void SetupControlPanel(void) ...@@ -2662,8 +2648,7 @@ void SetupControlPanel(void)
} while(!findnext(&f)); } while(!findnext(&f));
#else #else
glob_t globbuf; glob_t globbuf;
char name[13]; int which, x;
int which, i, x;
CA_CacheGrChunk(STARTFONT+1); CA_CacheGrChunk(STARTFONT+1);
#ifndef SPEAR #ifndef SPEAR
...@@ -2907,6 +2892,9 @@ int HandleMenu(CP_iteminfo *item_i,CP_itemtype *items,void (*routine)(int w)) ...@@ -2907,6 +2892,9 @@ int HandleMenu(CP_iteminfo *item_i,CP_itemtype *items,void (*routine)(int w))
// //
TicDelay(20); TicDelay(20);
break; break;
default:
break;
} }
if (ci.button0 || if (ci.button0 ||
...@@ -3128,7 +3116,7 @@ void ReadAnyControl(ControlInfo *ci) ...@@ -3128,7 +3116,7 @@ void ReadAnyControl(ControlInfo *ci)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int Confirm(char *string) int Confirm(char *string)
{ {
int xit=0,i,x,y,tick=0,time,whichsnd[2]={ESCPRESSEDSND,SHOOTSND}; int xit=0,x,y,tick=0,whichsnd[2]={ESCPRESSEDSND,SHOOTSND};
Message(string); Message(string);
......
...@@ -580,10 +580,7 @@ void CenterWindow(word w,word h) ...@@ -580,10 +580,7 @@ void CenterWindow(word w,word h)
void CheckKeys (void) void CheckKeys (void)
{ {
int i;
byte scan; byte scan;
unsigned temp;
if (screenfaded || demoplayback) // don't do anything with a faded screen if (screenfaded || demoplayback) // don't do anything with a faded screen
return; return;
...@@ -883,10 +880,8 @@ void GetNewActor (void) ...@@ -883,10 +880,8 @@ void GetNewActor (void)
========================= =========================
*/ */
void RemoveObj (objtype *gone) void RemoveObj(objtype *gone)
{ {
objtype **spotat;
if (gone == player) if (gone == player)
Quit ("RemoveObj: Tried to remove the player!"); Quit ("RemoveObj: Tried to remove the player!");
...@@ -1287,13 +1282,11 @@ think: ...@@ -1287,13 +1282,11 @@ think:
= =
=================== ===================
*/ */
long funnyticount;
long funnyticount;
void PlayLoop (void) void PlayLoop()
{ {
int give;
playstate = lasttimecount = 0; playstate = lasttimecount = 0;
set_TimeCount(0); set_TimeCount(0);
...@@ -1374,4 +1367,3 @@ void PlayLoop (void) ...@@ -1374,4 +1367,3 @@ void PlayLoop (void)
if (playstate != ex_died) if (playstate != ex_died)
FinishPaletteShifts (); FinishPaletteShifts ();
} }
...@@ -2,15 +2,6 @@ ...@@ -2,15 +2,6 @@
#include "wl_def.h" #include "wl_def.h"
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
/* /*
============================================================================= =============================================================================
...@@ -37,7 +28,6 @@ dirtype diagonal[9][9] = ...@@ -37,7 +28,6 @@ dirtype diagonal[9][9] =
}; };
void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state); void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state);
void NewState (objtype *ob, statetype *state); void NewState (objtype *ob, statetype *state);
...@@ -51,19 +41,8 @@ boolean CheckLine (objtype *ob); ...@@ -51,19 +41,8 @@ boolean CheckLine (objtype *ob);
void FirstSighting (objtype *ob); void FirstSighting (objtype *ob);
boolean CheckSight (objtype *ob); boolean CheckSight (objtype *ob);
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
//=========================================================================== //===========================================================================
/* /*
=================== ===================
= =
...@@ -179,7 +158,7 @@ void NewState (objtype *ob, statetype *state) ...@@ -179,7 +158,7 @@ void NewState (objtype *ob, statetype *state)
boolean TryWalk (objtype *ob) boolean TryWalk (objtype *ob)
{ {
int doornum; int doornum;
unsigned temp; unsigned temp;
doornum = -1; doornum = -1;
...@@ -223,6 +202,9 @@ boolean TryWalk (objtype *ob) ...@@ -223,6 +202,9 @@ boolean TryWalk (objtype *ob)
ob->tilex--; ob->tilex--;
ob->tiley--; ob->tiley--;
break; break;
default:
break;
} }
} }
else else
...@@ -471,9 +453,9 @@ void SelectDodgeDir (objtype *ob) ...@@ -471,9 +453,9 @@ void SelectDodgeDir (objtype *ob)
============================ ============================
*/ */
void SelectChaseDir (objtype *ob) void SelectChaseDir(objtype *ob)
{ {
int deltax,deltay,i; int deltax,deltay;
dirtype d[3]; dirtype d[3];
dirtype tdir, olddir, turnaround; dirtype tdir, olddir, turnaround;
...@@ -583,9 +565,9 @@ void SelectChaseDir (objtype *ob) ...@@ -583,9 +565,9 @@ void SelectChaseDir (objtype *ob)
void SelectRunDir (objtype *ob) void SelectRunDir (objtype *ob)
{ {
int deltax,deltay,i; int deltax, deltay;
dirtype d[3]; dirtype d[3];
dirtype tdir, olddir, turnaround; dirtype tdir;
deltax=player->tilex - ob->tilex; deltax=player->tilex - ob->tilex;
...@@ -937,6 +919,8 @@ void KillActor (objtype *ob) ...@@ -937,6 +919,8 @@ void KillActor (objtype *ob)
PlaceItemType (bo_key1,tilex,tiley); PlaceItemType (bo_key1,tilex,tiley);
break; break;
#endif #endif
default:
break;
} }
gamestate.killcount++; gamestate.killcount++;
...@@ -1009,7 +993,8 @@ void DamageActor (objtype *ob, unsigned damage) ...@@ -1009,7 +993,8 @@ void DamageActor (objtype *ob, unsigned damage)
NewState (ob,&s_sspain1); NewState (ob,&s_sspain1);
break; break;
default:
break;
} }
} }
} }
...@@ -1038,11 +1023,10 @@ boolean CheckLine (objtype *ob) ...@@ -1038,11 +1023,10 @@ boolean CheckLine (objtype *ob)
int x1,y1,xt1,yt1,x2,y2,xt2,yt2; int x1,y1,xt1,yt1,x2,y2,xt2,yt2;
int x,y; int x,y;
int xdist,ydist,xstep,ystep; int xdist,ydist,xstep,ystep;
int temp;
int partial,delta; int partial,delta;
long ltemp; long ltemp;
int xfrac,yfrac,deltafrac; int xfrac,yfrac,deltafrac;
unsigned value,intercept; word value,intercept;
x1 = ob->x >> UNSIGNEDSHIFT; // 1/256 tile precision x1 = ob->x >> UNSIGNEDSHIFT; // 1/256 tile precision
y1 = ob->y >> UNSIGNEDSHIFT; y1 = ob->y >> UNSIGNEDSHIFT;
...@@ -1227,17 +1211,16 @@ boolean CheckSight (objtype *ob) ...@@ -1227,17 +1211,16 @@ boolean CheckSight (objtype *ob)
if (deltax > 0) if (deltax > 0)
return false; return false;
break; break;
default:
break;
} }
// //
// trace a line to check for blocking tiles (corners) // trace a line to check for blocking tiles (corners)
// //
return CheckLine (ob); return CheckLine (ob);
} }
/* /*
=============== ===============
= =
...@@ -1382,6 +1365,8 @@ void FirstSighting (objtype *ob) ...@@ -1382,6 +1365,8 @@ void FirstSighting (objtype *ob)
break; break;
#endif #endif
default:
break;
} }
if (ob->distance < 0) if (ob->distance < 0)
...@@ -1473,6 +1458,8 @@ boolean SightPlayer (objtype *ob) ...@@ -1473,6 +1458,8 @@ boolean SightPlayer (objtype *ob)
case deathobj: case deathobj:
ob->temp2 = 1; ob->temp2 = 1;
break; break;
default:
break;
} }
return false; return false;
} }
......
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