This commit is contained in:
Rob Pearce 2006-01-27 06:27:57 +00:00
commit d6735eea16
35 changed files with 1753 additions and 0 deletions

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
rc: rc.c rc.h
gcc -mwindows -Wall -orc -g rc.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx

2
Makefile.posix Normal file
View File

@ -0,0 +1,2 @@
rc: rc.c rc.h
gcc -mwindows -Wall -orc -g rc.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx

2
Makefile.windows Normal file
View File

@ -0,0 +1,2 @@
rc: rc.c rc.h
gcc -mwindows -mno-cygwin -Wall -orc.exe -DWINDOWS -g rc.c `sdl-config --cflags --libs` -I/usr/local/include -lmingw32 -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx

BIN
blank.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
cheese.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
dwarf.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

32
emptylevel Normal file
View File

@ -0,0 +1,32 @@
tileset greentiles
bg 0
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BIN
full.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

67
greentiles Normal file
View File

@ -0,0 +1,67 @@
tile blank
id 0
solid 0
file blank.bmp
end
tile land
id 1
solid 1
file land.bmp
end
tile slopeup
id 2
solid 2
lowness 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
file slopeup.bmp
end
tile slopedown
id 3
solid 2
lowness 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
file slopedown.bmp
end
tile full
id 4
solid 1
file full.bmp
end
tile sky
id 5
solid 0
file sky.bmp
end
tile ladder
id 6
solid 0
file ladder.bmp
end
tile laddertop
id 7
solid 1
file laddertop.bmp
end
tile right
id 8
solid 1
file right.bmp
end
tile left
id 9
solid 1
file left.bmp
end
tile spikes
id 10
solid 0
file spikes.bmp
end

BIN
ladder.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
laddertop.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
land.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
left.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

31
level.dat Normal file
View File

@ -0,0 +1,31 @@
bg 0
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~~~~~~~~~~~~000000000000000000
~~000000000000000*\000000000000000000000
~~0000000000000000*\00000000000000000000
~~00000000000000000*\0000000000000000000
~~000000~~~~00000000*~~~~~~~~~~~~0000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000~00000000000
~~0000~~~~000000000000/~~\00*00000000000
~~0000000000000000000/****~~*00000000000
~~000000000000000000/********\0000000000
~~000000000000000/~~**********\000000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

32
level1.dat Normal file
View File

@ -0,0 +1,32 @@
tileset greentiles
bg 0
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*000000000r0000000000000000000000000000*
*000000~~~~~~~~~~~~**000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000001000000000000000000000*
*000000000000~~~~~~~~~~~~~~~00000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*0000000000r000000000000000000000r00000*
*000~~~~~~~~~~~~~~0000~~~~~0000~~~~~000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*000000000000000000000000r0000000000000*
*000~~~~~0000~~~~~0000~~~~~~~~~~~~~~000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000r00000000000000000000000000*
*000~~~~~~~~~~~~~~0000~~~~~0000~~~~~000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*000000000000000000000000r0000000000000*
*000~~~~~0000~~~~~0000~~~~~~~~~~~~~~000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
*00000000000000000000000000000000000000*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BIN
oldblank.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
pdwarf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

BIN
pdwarffall.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

BIN
pdwarfjump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

BIN
pfall.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
pjump.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
player.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
rat.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
ratcaught.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
ratdead.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

1316
rc.c Normal file

File diff suppressed because it is too large Load Diff

163
rc.h Normal file
View File

@ -0,0 +1,163 @@
#include <SDL_image.h>
#define NETSPEED 9
#define MAXMONSTERSPERLEVEL 20
#define MAXPTYPES 3
#define MAXFRAMES 8
#define TILEH 16
#define TILEW 16
#define LEVELW 40
#define LEVELH 30
#define BUFLEN 512
#define SMALLBUFLEN 32
#define FALLSPEED 4
#define B_TRUE -1
#define B_FALSE 0
typedef struct tiletype_s {
int id;
char name[SMALLBUFLEN];
int lowness[TILEW];
int solid;
SDL_Surface *img;
struct tiletype_s *next;
struct tiletype_s *prev;
} tiletype_t;
tiletype_t *tiletype;
typedef struct initialmonster_s {
int startx;
int starty;
int id;
} initialmonster_t;
typedef struct level_s {
int id;
int bgtileid;
char name[SMALLBUFLEN];
int map[LEVELW*LEVELH];
struct level_s *next;
struct level_s *prev;
int p1x; /* player 1 start pos */
int p1y;
int nummonsters;
initialmonster_t initm[MAXMONSTERSPERLEVEL];
} level_t;
level_t *level;
typedef struct sprite_s {
int id;
double speed;
int falling;
int fallspeed;
int jumping;
int jumpdir;
int dead;
int bounces;
struct sprite_s *caughtby;
int caughtstate;
int jumpspeed;
int slamming;
double slamangle;
int netting;
int netspeed;
int netdir;
int netlen;
int nety;
int netxstart;
int netystart;
int moved;
double xs,ys;
double x,y;
int dir;
SDL_Surface *img;
SDL_Surface *netbg;
struct sprite_s *next;
struct sprite_s *prev;
char name[SMALLBUFLEN];
} sprite_t;
typedef struct imageset_s {
SDL_Surface *img[MAXFRAMES*2];
int numimages;
} imageset_t;
imageset_t imageset[MAXPTYPES];
void cleanup(void);
int addsprite(int id,int x, int y, char *name);
int loadtiletypes(char *filename);
tiletype_t *gettileat(int pixx,int pixy, int *tilex, int *tiley);
int loadlevel(int lnum);
int loadsprites(void);
int loadimagesets(void);
void drawlevel(void);
void drawtile(int x, int y);
void removesprite(sprite_t *s);
void removenetting(sprite_t *s);
void drawsprite(sprite_t *s);
void drawnetting(sprite_t *s);
void dogravity(sprite_t *s);
void dotileeffects(sprite_t *s);
int movex(sprite_t *s,double amt);
void movesprite(sprite_t *s);
int isonground(sprite_t *s);
int isongroundpoint(sprite_t *s, int x, int y);
int isonladder(sprite_t *s);
int isladderabove(sprite_t *s);
int isfruit(int id);
int ismonster(int id);
void killsprite(sprite_t *s);
void checkcollide(sprite_t *s);
double getspeed(int id);
void adjustheight(sprite_t *s);
#define S_NOTSOLID 0
#define S_SOLID 1
#define S_SLOPE 2
#define P_PLAYER 0
#define P_RAT 1
#define P_CHEESE 2
#define F_WALK1 0
#define F_JUMP 1
#define F_FALL 2
#define F_CAUGHT 3
#define F_DEAD 4
#define F_DEAD2 5
#define F_DEAD3 6
#define F_DEAD4 7
#define T_BLANK 0
#define T_LAND 1
#define T_SLOPEUP 2
#define T_SLOPEDOWN 3
#define T_FULL 4
#define T_SKY 5
#define T_LADDER 6
#define T_LADDERTOP 7
#define T_RIGHT 8
#define T_LEFT 9
#define T_SPIKES 10
inline void drawpixel16(SDL_Surface *screen, int x, int y, SDL_Color c);
inline void drawbox16(SDL_Surface *screen, int x1,int y1,int x2,int y2,SDL_Color *c,SDL_Color *fc);
void drawline16(SDL_Surface *screen, int x1, int y1, int x2, int y2, SDL_Color c);

BIN
right.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
sky.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
slopedown.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
slopeup.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

BIN
spikes.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

37
svn-commit.tmp Normal file
View File

@ -0,0 +1,37 @@
initial checkin
--This line, and those below, will be ignored--
AM full.bmp
AM sky.bmp
A emptylevel
AM slopedown.bmp
AM right.bmp
AM laddertop.bmp
A level1.dat
AM blank.bmp
AM pdwarf.png
A Makefile.windows
AM pjump.bmp
AM ladder.bmp
AM player.bmp
AM cheese.bmp
AM pfall.bmp
A Makefile
A level.dat
AM ratdead.bmp
AM dwarf.jpg
A rc.c
A rc.h
AM land.bmp
AM ratcaught.bmp
A greentiles
AM pdwarfjump.png
AM rat.bmp
AM oldblank.bmp
A tiles.conf
AM slopeup.bmp
AM pdwarffall.png
A testlevel
AM left.bmp
AM spikes.bmp
A Makefile.posix

32
testlevel Normal file
View File

@ -0,0 +1,32 @@
tileset greentiles
bg 0
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000000000000000000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~0000000000~000000000000000000
~~00000000~~~~~~~~~~~~000000000000000000
~~000000000000000*\000000000000000000000
~~0000000000000000*\00000000000000000000
~~00000000000000000*\0000000000000000000
~~000000~~~~-~~00000*~~~~~~~~~~~~0000000
~~0000000000=000000000000000000000000000
~~0000000000=000000000000000000000000000
~~0000^^0000=000000000000000~00000000000
~~0000~~~~00=000000000/<<\00*00000000000
~~0000000000=00000000/****>>*00000000000
~~0000000000=0000000/********\0000000000
~~0100000000=0000/~~**********\000000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

37
tiles.conf Normal file
View File

@ -0,0 +1,37 @@
tile blank
id 0
solid 0
file blank.bmp
end
tile land
id 1
solid 1
file land.bmp
end
tile slopeup
id 2
solid 2
lowness 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
file slopeup.bmp
end
tile slopedown
id 3
solid 2
lowness 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
file slopedown.bmp
end
tile full
id 4
solid 1
file full.bmp
end
tile sky
id 5
solid 0
file sky.bmp
end