summaryrefslogtreecommitdiff
path: root/galax.c
diff options
context:
space:
mode:
Diffstat (limited to 'galax.c')
-rw-r--r--galax.c127
1 files changed, 57 insertions, 70 deletions
diff --git a/galax.c b/galax.c
index 3366f81..c67db3e 100644
--- a/galax.c
+++ b/galax.c
@@ -10,6 +10,8 @@
#include <fcntl.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "Xbit.h"
@@ -34,7 +36,7 @@
#define CH(x,y) ((x)*SCALE),((y)*SCALE),SCALE,SCALE
XSizeHints size_hints;
-int black,white;
+ulong black,white;
Display *disp;
Window top,sub;
Colormap cm;
@@ -269,7 +271,7 @@ static Colour cols[NOCOLS]=
#define NOPLXST 30
#define NOPLXPL 3
-struct {int x,y,c} plxst[NOPLXST][NOPLXPL];
+struct {int x,y,c;} plxst[NOPLXST][NOPLXPL];
/* User bullet vars
@@ -296,8 +298,11 @@ int PAUSESKIP =0;
int FONT =0;
int SCALE =1;
-int POKEIMG_NS(),POKEIMG_S();
-int (*POKEIMG)();
+
+static void POKEIMG_NS(XImage *img, int x, int y, ulong c);
+static void POKEIMG_S(XImage *img, int x, int y, ulong c);
+
+void (*POKEIMG)(XImage *img, int x, int y, ulong c);
/* Game and control vars
@@ -312,11 +317,24 @@ int score,level,levelndx,lives;
int shipx,hit,miss,dead;
int aliendead;
-
-int main(argc,argv)
-int argc;
-char *argv[];
-
+static void ReadScores(void);
+static void WriteScores(void);
+static void ClearExplosions(void);
+static void NewExplosion(int x, int y, int w);
+static void UpdateExplosions(void);
+static void InitAlien(int f, int x, int y, int t);
+static void SinCos(int cx, int cy, int a, int rx, int ry, int *x, int *y);
+static void DefineAliens(void);
+static void MoveAliens(void);
+static void CheckAlienShot(Alien *a);
+static void DrawAndKillAliens(void);
+static void ClearBullets(void);
+static void ClearKeys(void);
+static void DoDebugMenu(void);
+static int Paused(int k);
+
+
+int main(int argc, char *argv[])
{
void IntrHandler();
int f,r,x,y,arg,noshm;
@@ -552,7 +570,7 @@ static XFuncControl Key(Window w, XPressRelease s, XEvent *e)
}
-int GetKey()
+static int GetKey(void)
{
int k=inkey;
@@ -564,7 +582,7 @@ int GetKey()
}
-KeySym RawKey()
+static KeySym RawKey(void)
{
KeySym k=last_keysym;
@@ -574,7 +592,7 @@ KeySym RawKey()
}
-ClearKeys()
+static void ClearKeys(void)
{
int f;
@@ -587,9 +605,7 @@ ClearKeys()
/* ----------------------------------------------- GRAPHICS UTILS
*/
-Cls(plx,xi,yi,clr)
-int plx,xi,yi,clr;
-
+static void Cls(int plx,int xi,int yi,int clr)
{
static unsigned int col;
int f,r,x,y;
@@ -641,35 +657,26 @@ int plx,xi,yi,clr;
}
-Update()
+static void Update(void)
{
DrawXImage(img);
XSync(disp,False);
}
-Centre(y,c,s)
-int y,c;
-char *s;
-
+static void Centre(int y, ulong c, const char *s)
{
XIprintf(img,CH(WINWH-strlen(s)*4,y),c,"%s",s);
}
-POKEIMG_NS(img,x,y,c)
-XImage *img;
-int x,y,c;
-
+static void POKEIMG_NS(XImage *img, int x, int y, ulong c)
{
XPutPixel(img,x,y,c);
}
-POKEIMG_S(img,x,y,c)
-XImage *img;
-int x,y,c;
-
+static void POKEIMG_S(XImage *img, int x, int y, ulong c)
{
int sx,sy;
@@ -679,19 +686,14 @@ int x,y,c;
}
-Plot(x,y,c)
-int x,y,c;
-
+static void Plot(int x, int y, ulong c)
{
if ((x>=0)&&(x<WINW)&&(y>=0)&&(y<WINH))
(*POKEIMG)(img,x,y,c);
}
-Sprite(s,x,y,coll,collcode)
-int s,x,y;
-CollData *coll;
-
+static void Sprite(int s, int x, int y, CollData *coll, int collcode)
{
int sx,sy;
@@ -719,7 +721,7 @@ CollData *coll;
/* ----------------------------------------------- USER BULLET UTILS
*/
-ClearBullets()
+static void ClearBullets(void)
{
int f;
@@ -730,9 +732,7 @@ ClearBullets()
}
-NewBullet(x,y)
-int x,y;
-
+static void NewBullet(int x, int y)
{
int f;
@@ -747,14 +747,13 @@ int x,y;
}
-DeleteBullet(f,y)
-
+static void DeleteBullet(int f)
{
ubull[f].inuse=False;
}
-int BulletsInUse()
+static int BulletsInUse(void)
{
int f,c;
@@ -766,13 +765,13 @@ int BulletsInUse()
}
-int FreeBullets()
+static int FreeBullets(void)
{
return(BulletsInUse()<NOBULL);
}
-int UpdateBullets()
+static void UpdateBullets(void)
{
CollData coll;
int f;
@@ -855,8 +854,7 @@ static XFuncControl ProcessTitle(void)
}
-DoDebugMenu(fl)
-
+static void DoDebugMenu(void)
{
static int debug_menu=False;
KeySym k;
@@ -1107,7 +1105,7 @@ static XFuncControl ProcessGame(void)
/* ----------------------------------------------- PAUSE CODE
*/
-DoPause()
+static void DoPause(void)
{
static unsigned int c=0;
@@ -1122,9 +1120,7 @@ DoPause()
}
-int Paused(k)
-int k;
-
+static int Paused(int k)
{
static int paused=False;
@@ -1172,7 +1168,7 @@ static XFuncControl ProcessGameOver(void)
/* ----------------------------------------------- HI SCORES
*/
-ReadScores()
+static void ReadScores(void)
{
int fd,f;
@@ -1186,7 +1182,7 @@ ReadScores()
}
-WriteScores()
+static void WriteScores(void)
{
int fd,f;
@@ -1298,7 +1294,7 @@ static XFuncControl ProcessHiScore(void)
/* ----------------------------------------------- PARTICLE EXPLOSION ROUTINES
*/
-ClearExplosions()
+static void ClearExplosions(void)
{
int f;
@@ -1309,9 +1305,7 @@ ClearExplosions()
}
-NewExplosion(x,y,w)
-int x,y,w;
-
+static void NewExplosion(int x, int y, int w)
{
int f,r;
@@ -1332,7 +1326,7 @@ int x,y,w;
}
-UpdateExplosions()
+static void UpdateExplosions(void)
{
int f,r;
@@ -1356,9 +1350,7 @@ int alienctr;
int alienyi;
int alienxi;
-InitAlien(f,x,y,t)
-int f,x,y,t;
-
+static void InitAlien(int f, int x, int y, int t)
{
alien[f].alive=True;
alien[f].type=t;
@@ -1368,9 +1360,7 @@ int f,x,y,t;
}
-SinCos(cx,cy,a,rx,ry,x,y)
-int cx,cy,a,rx,ry,*x,*y;
-
+static void SinCos(int cx, int cy, int a, int rx, int ry, int *x, int *y)
{
double dx,dy;
@@ -1382,7 +1372,7 @@ int cx,cy,a,rx,ry,*x,*y;
}
-DefineAliens()
+static void DefineAliens(void)
{
int f,x,y;
@@ -1587,7 +1577,7 @@ DefineAliens()
}
-MoveAliens()
+static void MoveAliens(void)
{
int f,x,y;
int flag=False;
@@ -1762,9 +1752,7 @@ MoveAliens()
}
-CheckAlienShot(a)
-Alien *a;
-
+static void CheckAlienShot(Alien *a)
{
if ((levdata[levelndx].shot_type==NOSHOT)||(dead))
return;
@@ -1821,8 +1809,7 @@ Alien *a;
}
-DrawAndKillAliens()
-
+static void DrawAndKillAliens(void)
{
CollData coll;
int f,r;