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