Actually adding changes from last commit..

This commit is contained in:
Rob Pearce 2016-07-22 17:58:26 +10:00
parent 0dcf697683
commit 02854f09b3
15 changed files with 189 additions and 48 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
*.app
*.zip
.bash_history
.svn
*.dSYM
*.swp
.DS_Store
scripts/level*.png
# Local work dirs
staging/
orig/
# binaries
rc
edit

View File

@ -3,10 +3,10 @@ LIBS = libs/libSDL-1.2.0.dylib libs/libSDL_image-1.2.0.dylib libs/libSDL_mixer-1
all: rc edit all: rc edit
rc: rc.c shared.c rc.h shared.h globals.h defs.h rc: rc.c shared.c rc.h shared.h globals.h defs.h
gcc -Wall -DREV=`./getsvnrev.sh` -o rc -g rc.c shared.c `sdl-config --cflags --libs` -lsqlite3 -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_Mixer gcc -Wall -DREV=\"`git rev-parse HEAD`\" -o rc -g rc.c shared.c `sdl-config --cflags --libs` -lsqlite3 -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_Mixer
edit: edit.c shared.c edit.h shared.h globals.h defs.h edit: edit.c shared.c edit.h shared.h globals.h defs.h
gcc -DREV=`./getsvnrev.sh` -D__EDITOR -Wall -o edit -g edit.c shared.c `sdl-config --cflags --libs` -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf gcc -DREV=\"`git rev-parse HEAD`\" -D__EDITOR -Wall -o edit -g edit.c shared.c `sdl-config --cflags --libs` -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf
app: rc app: rc
if [ `uname -s` != "Darwin" ]; then echo "Mac .app bundle generation is only available under OSX."; exit 1; fi; if [ `uname -s` != "Darwin" ]; then echo "Mac .app bundle generation is only available under OSX."; exit 1; fi;

Binary file not shown.

View File

@ -12,7 +12,6 @@ monsters
1 27 4 1 27 4
1 4 8 1 4 8
18 28 27 18 28 27
7 10 1
6 17 3 6 17 3
16 22 17 16 22 17
16 18 17 16 18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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,38,
layer2 layer2
12,13,94,layer3 12,13,94,layer3

View File

@ -69,15 +69,15 @@ exitdir 1
4,4,4,7,0,0,0,0,0,0,0,0,0,0,18,4,4,4,4,4,4,15,15,15,15,15,15,4,0,0,0,0,4,15,15,15,15,15,15,4, 4,4,4,7,0,0,0,0,0,0,0,0,0,0,18,4,4,4,4,4,4,15,15,15,15,15,15,4,0,0,0,0,4,15,15,15,15,15,15,4,
4,4,4,7,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,15,15,15,15,15,15,4,0,0,0,0,4,15,15,15,15,15,15,4, 4,4,4,7,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,15,15,15,15,15,15,4,0,0,0,0,4,15,15,15,15,15,15,4,
4,4,4,1,1,1,40,40,40,1,1,40,40,40,40,38,4,4,4,4,4,15,15,15,15,15,15,4,12,0,0,0,4,15,15,15,15,15,15,4, 4,4,4,1,1,1,40,40,40,1,1,40,40,40,40,38,4,4,4,4,4,15,15,15,15,15,15,4,12,0,0,0,4,15,15,15,15,15,15,4,
4,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,4,13,0,0,0,4,15,15,15,15,15,15,4, 4,4,4,7,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,4,13,0,0,0,4,15,15,15,15,15,15,4,
4,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,4,1,16,16,16,4,15,15,15,15,15,15,4, 4,4,4,7,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,4,1,16,16,16,4,15,15,15,15,15,15,4,
4,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4, 4,4,4,7,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,
4,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4, 4,4,4,7,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,
4,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,4, 4,4,4,1,1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,4,
4,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,1,4,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,15,15,1,4,4,
4,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,1,4,4,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,15,15,1,4,4,4,
4,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,1,4,4,4,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,1,15,15,15,15,15,15,15,15,15,1,4,4,4,4,
4,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,1,4,4,4,4,4, 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,4,4,4,4,4,4,4,1,15,15,15,15,15,15,15,1,4,4,4,4,4,
39,1,1,40,40,40,1,1,1,1,40,40,40,40,40,1,1,40,1,38,4,4,4,4,4,4,4,1,1,1,1,1,1,1,4,4,4,4,4,4, 39,1,1,40,40,40,1,1,1,1,40,40,40,40,40,1,1,40,1,38,4,4,4,4,4,4,4,1,1,1,1,1,1,1,4,4,4,4,4,4,
layer2 layer2
22,4,37 22,4,37

View File

@ -669,3 +669,12 @@ solid 2
slippery 1 slippery 1
file newtiles/icebridgethick.png file newtiles/icebridgethick.png
end end
tile animspike
id 28
solid 0
dir newtiles
file !animspike1.png ^animspike2.png x10 animspike2.png animspike3.png animspike4.png animspike5.png animspike6.png animspike7.png animspike8.png animspike9.png x20
animspeed 3
animsync
end

5
defs.h
View File

@ -355,7 +355,7 @@ enum SPELL {
#define MAXLETTERHEIGHT 100 #define MAXLETTERHEIGHT 100
#define MAXFRAMES 18 // max number of frames for sprites #define MAXFRAMES 18 // max number of frames for sprites
#define MAXHELP 5 #define MAXHELP 5
#define MAXTILEFRAMES 10 // max number of frames for animated tiles #define MAXTILEFRAMES 100 // max number of frames for animated tiles
#define MAXCARDS 5 // how many cards a player can have #define MAXCARDS 5 // how many cards a player can have
@ -862,6 +862,7 @@ enum SPELL {
#define T_WARP 25 // hidden warp point - jump to reveal #define T_WARP 25 // hidden warp point - jump to reveal
#define T_ICEBRIDGE 26 // like land but you can drop down through it #define T_ICEBRIDGE 26 // like land but you can drop down through it
#define T_ICEBRIDGETH 27 // thicker version of ice bridge which doesn't melt #define T_ICEBRIDGETH 27 // thicker version of ice bridge which doesn't melt
#define T_ANIMSPIKE 28
// death states // death states
#define D_INITIAL (1) // Need to trigger death sequence #define D_INITIAL (1) // Need to trigger death sequence
@ -923,6 +924,8 @@ typedef struct tiletype_s {
int slippery; int slippery;
int walkvanish; // -1 means 'don't vanish' int walkvanish; // -1 means 'don't vanish'
SDL_Surface *img[MAXTILEFRAMES]; SDL_Surface *img[MAXTILEFRAMES];
int killframe[MAXTILEFRAMES];
int spikeframe[MAXTILEFRAMES];
int numframes; int numframes;
int animspeed; int animspeed;
int animsync; int animsync;

View File

@ -1,4 +1,11 @@
this_wonderful_life.mod snorewalk.mod = in-game music
bonus.mod by Deelite
this_wonderful_life.mod = boss music
by Teo / Fatal Rage
prosynt6.mod = hiscores music
by Jess
(http://amp.dascene.net/detail.php?detail=modules&view=8491)
Original font: bluestone Original font: bluestone

2
edit.c
View File

@ -166,7 +166,7 @@ int main (int argc, char **argv) {
} }
// set title bar // set title bar
sprintf(progname, "Rat Catcher Level Editor v0.%d", REV); sprintf(progname, "Rat Catcher Level Editor");
SDL_WM_SetCaption(progname, progname); SDL_WM_SetCaption(progname, progname);
/* load fonts */ /* load fonts */

View File

@ -1,3 +1,8 @@
#!/bin/sh #!/bin/sh
#svn info | grep Revision | cut -d " " -f 2 #svn info | grep Revision | cut -d " " -f 2
svnversion . | cut -d: -f2 | sed -e 's/M//g' VER=`svnversion . 2>/dev/null`
if [ $? -ne 0 ]; then
echo "1"
else
echo $VER | cut -d: -f2 | sed -e 's/M//g'
fi

60
rc.c
View File

@ -1,5 +1,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
@ -256,7 +258,7 @@ int main (int argc, char **argv) {
// set program name (including version string) // set program name (including version string)
sprintf(progname, "Rat Catcher v0.%d", REV); sprintf(progname, "Rat Catcher");
/* handle arguments */ /* handle arguments */
if (argc >= 2) { if (argc >= 2) {
@ -350,8 +352,11 @@ int main (int argc, char **argv) {
datadir = strdup("data"); datadir = strdup("data");
} }
initsdl(); initsdl();
if (TTF_Init()) { if (TTF_Init()) {
printf("TTF_Init: %s\n", TTF_GetError()); printf("TTF_Init: %s\n", TTF_GetError());
} }
@ -3569,7 +3574,7 @@ int movesprite(sprite_t *s) {
} }
} else if (s->id == P_DRIP) { // water drip from melting tile } else if (s->id == P_DRIP) { // water drip from melting tile
// fall downwards // fall downwards
if (isinwater(s) && !s->iced && isongroundpoint(s, s->x, s->y+1)) { if (isinwater(s) || isongroundpoint(s, s->x, s->y+1)) {
s->dead = D_FINAL; s->dead = D_FINAL;
} else { } else {
s->y += s->fallspeed; s->y += s->fallspeed;
@ -6908,10 +6913,23 @@ void dotileeffects(sprite_t *s) {
} }
break; break;
} }
if (isdeadly(tt, tilex, tiley)) {
if (!isfruit(s->id) ) {
if (!s->invuln) {
if ((s->id != P_BLACKCLOUD) && (s->id != P_KINGSNAIL) && (s->id != P_KINGCAT)) {
die(s);
printf("DB: killed by deadly tile\n"); fflush(stdout);
}
}
}
finished = B_TRUE;
}
/* check under us */ if (!finished) {
tt = gettileat(s->x,s->y+3,&tilex,&tiley); /* check under us */
tt = gettileat(s->x,s->y+3,&tilex,&tiley);
}
// CHECKS WHICH COULD APPLY TO TILES UNDER AND SLIGHTLY LEFT/RIGHT OF US // CHECKS WHICH COULD APPLY TO TILES UNDER AND SLIGHTLY LEFT/RIGHT OF US
while (!finished) { while (!finished) {
@ -6954,7 +6972,7 @@ void dotileeffects(sprite_t *s) {
} }
} }
finished = B_TRUE; finished = B_TRUE;
} else if (tt->spikes) { } else if (isspikes(tt, tilex, tiley)) {
if (!isfruit(s->id) ) { if (!isfruit(s->id) ) {
if (!s->invuln) { if (!s->invuln) {
if ((s->id != P_BLACKCLOUD) && (s->id != P_KINGSNAIL) && (s->id != P_KINGCAT)) { if ((s->id != P_BLACKCLOUD) && (s->id != P_KINGSNAIL) && (s->id != P_KINGCAT)) {
@ -8512,6 +8530,29 @@ int isladderbelow(sprite_t *s) {
return B_FALSE; return B_FALSE;
} }
int isdeadly(tiletype_t *tt, int tx, int ty) {
int curframe;
curframe = curlevel->tileframe[ty*LEVELW+tx];
if (tt->killframe[curframe]) {
return B_TRUE;
}
return B_FALSE;
}
int isspikes(tiletype_t *tt, int tx, int ty) {
int curframe;
if (tt->spikes) return B_TRUE;
curframe = curlevel->tileframe[ty*LEVELW+tx];
if (tt->spikeframe[curframe]) {
return B_TRUE;
}
return B_FALSE;
}
int isinwater(sprite_t *s) { int isinwater(sprite_t *s) {
return isinwaterpoint(s->x, s->y - s->img->h/2); return isinwaterpoint(s->x, s->y - s->img->h/2);
} }
@ -10687,7 +10728,7 @@ int initsound(void) {
sprintf(filename, "%s/music/main.mod",datadir); sprintf(filename, "%s/music/main.mod",datadir);
normalmusic = Mix_LoadMUS(filename); normalmusic = Mix_LoadMUS(filename);
if (!normalmusic) { if (!normalmusic) {
printf("can't load music\n"); printf("can't load music: %s\n", Mix_GetError());
return B_TRUE; return B_TRUE;
} }
@ -13101,7 +13142,7 @@ void dotitlescreen(void) {
helpoff = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Off", green2); helpoff = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "Off", green2);
helpon = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "On", green2); helpon = TTF_RenderText_Solid(font[TEXTSIZE_TITLE], "On", green2);
sprintf(svnver, "v0.%d",REV); sprintf(svnver, "%s", REV);
ver = TTF_RenderText_Solid(font[TEXTSIZE_VER], svnver, greenish); ver = TTF_RenderText_Solid(font[TEXTSIZE_VER], svnver, greenish);
@ -13169,7 +13210,8 @@ void dotitlescreen(void) {
if (titlemode != TS_HISCORES) { if (titlemode != TS_HISCORES) {
// version number // version number
area.x = 640 - (ver->w) - 10; //area.x = 640 - (ver->w) - 10;
area.x = (640/2) - (ver->w/2) - 10;
area.y = 150; area.y = 150;
SDL_SetColors(ver, &black, 1, 1); SDL_SetColors(ver, &black, 1, 1);
SDL_BlitSurface(ver, NULL, screen, &area); SDL_BlitSurface(ver, NULL, screen, &area);

2
rc.h
View File

@ -17,6 +17,7 @@ void dotileeffects(sprite_t *s);
int movex(sprite_t *s,double amt,int onpurpose); int movex(sprite_t *s,double amt,int onpurpose);
void bouncesprite(sprite_t *s); void bouncesprite(sprite_t *s);
int movesprite(sprite_t *s); int movesprite(sprite_t *s);
int isdeadly(tiletype_t *tt, int tx, int ty);
int isinwater(sprite_t *s); int isinwater(sprite_t *s);
int isinwaterpoint(int x, int y); int isinwaterpoint(int x, int y);
int isroofabove(sprite_t *s); int isroofabove(sprite_t *s);
@ -27,6 +28,7 @@ int isonladder(sprite_t *s);
int isonbridge(sprite_t *s); int isonbridge(sprite_t *s);
int isladderabove(sprite_t *s); int isladderabove(sprite_t *s);
int isladderbelow(sprite_t *s); int isladderbelow(sprite_t *s);
int isspikes(tiletype_t *tt, int tx, int ty);
int dofruiteffect(sprite_t *pp, sprite_t *s); int dofruiteffect(sprite_t *pp, sprite_t *s);
void checkcollide(sprite_t *s); void checkcollide(sprite_t *s);
void checkcollideplatform(sprite_t *s); void checkcollideplatform(sprite_t *s);

View File

@ -1147,6 +1147,7 @@ int loadtiletypes(char *filename) {
char *p,*pp; char *p,*pp;
int uniq = 0 ; int uniq = 0 ;
strcpy(imagefile, "");
/* clear tiletype linked list */ /* clear tiletype linked list */
while (tiletype != NULL) { while (tiletype != NULL) {
@ -1213,6 +1214,8 @@ int loadtiletypes(char *filename) {
} }
for (i = 0; i < MAXTILEFRAMES; i++) { for (i = 0; i < MAXTILEFRAMES; i++) {
t->img[i] = NULL; t->img[i] = NULL;
t->killframe[i] = B_FALSE;
t->spikeframe[i] = B_FALSE;
} }
t->next = NULL; t->next = NULL;
state = 1; state = 1;
@ -1280,7 +1283,7 @@ int loadtiletypes(char *filename) {
p = strtok(buf, " "); p = strtok(buf, " ");
p = strtok(NULL, " "); p = strtok(NULL, " ");
t->water = atoi(p); t->water = atoi(p);
} else if (strstr(buf, "file") == buf) { } else if (strstr(buf, "file") == buf) { // ! means 'killframe', ^ is 'spikeframe'
int frame; int frame;
/* strip newline */ /* strip newline */
@ -1292,27 +1295,67 @@ int loadtiletypes(char *filename) {
frame = 0; frame = 0;
p = strtok(NULL, " "); p = strtok(NULL, " ");
while (p) { while (p) {
if (frame >= MAXTILEFRAMES) {
printf("FATAL error - tile %s frame #%d is greater than MAXTILEFRAMES\n",t->name,frame);
}
if (t->img[frame]) { if (t->img[frame]) {
printf("...already an img for frame #%d - freeing it.\n",frame);
SDL_FreeSurface(t->img[frame]); SDL_FreeSurface(t->img[frame]);
t->img[frame] = NULL; t->img[frame] = NULL;
} }
sprintf(imagefile, "%s/%s/%s",datadir,dirname,p);
//strcpy(imagefile, dirname);
//strcat(imagefile, "/");
//strcat(imagefile, p);
//t->img[frame] = IMG_Load(imagefile); if (strstr(p, "x") && !strchr(p, '.')) { // ie. x10, x1, etc
t->img[frame] = IMG_Load(imagefile); if (frame == 0) {
if (!t->img[frame]) { printf("FATAL ERROR: first frame can't be a repeat.\n");
printf("cannot load tile image file: '%s'\n",imagefile); exit(1);
fclose(f); } else {
return B_TRUE; int n,repeatcount,baseframe;
} // use previous one 'x' times
// black is transparent p++;
SDL_SetColorKey(t->img[frame], SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0, 0, 0)); repeatcount = atoi(p);
baseframe = frame-1;
for (n = 0; n < repeatcount; n++) {
if (!strlen(imagefile)) {
printf("FATAL ERROR: no previous imagefile to repeat.\n");
exit(1);
}
t->img[frame] = IMG_Load(imagefile);
if (!t->img[frame]) {
printf("cannot load tile image file: '%s'\n",imagefile);
fclose(f);
return B_TRUE;
}
t->killframe[frame] = t->killframe[baseframe];
frame++;
}
}
} else {
// exclamation mark indicates this is a 'killframe' (ie. if you stand
// on this tile when it hits this frame, you die)
if (*p == '!') {
t->killframe[frame] = B_TRUE;
p++;
} else if (*p == '^') {
t->spikeframe[frame] = B_TRUE;
p++;
}
sprintf(imagefile, "%s/%s/%s",datadir,dirname,p);
//strcpy(imagefile, dirname);
//strcat(imagefile, "/");
//strcat(imagefile, p);
//t->img[frame] = IMG_Load(imagefile);
t->img[frame] = IMG_Load(imagefile);
if (!t->img[frame]) {
printf("cannot load tile image file: '%s'\n",imagefile);
fclose(f);
return B_TRUE;
}
// black is transparent
SDL_SetColorKey(t->img[frame], SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0, 0, 0));
frame++;
}
// get next one
frame++;
p = strtok(NULL, " "); p = strtok(NULL, " ");
} }
t->numframes = frame; t->numframes = frame;
@ -1758,6 +1801,7 @@ int loadimagesets(void) {
} }
imageset[P_STAR].numimages = STARFRAMES; imageset[P_STAR].numimages = STARFRAMES;
loadspriteimage(P_UFO,F_WALK1, "sprites/ufo.png"); loadspriteimage(P_UFO,F_WALK1, "sprites/ufo.png");
imageset[P_UFO].numimages = 1; imageset[P_UFO].numimages = 1;
@ -1979,18 +2023,24 @@ int loadimagesets(void) {
for (i = 1; i <= 13; i++) { for (i = 1; i <= 13; i++) {
SDL_Surface *letter; SDL_Surface *letter;
SDL_Rect area; SDL_Rect area;
char str[2]; char str[3];
// HEARTS // HEARTS
loadspriteimage(P_FIRSTHEART+i-1, F_WALK1, "sprites/cardh.png"); loadspriteimage(P_FIRSTHEART+i-1, F_WALK1, "sprites/cardh.png");
//sprintf(str, "%s",getcardletter(i)); //sprintf(str, "%s",getcardletter(i));
strcpy(str, getcardletter(i)); strcpy(str, getcardletter(i));
letter = TTF_RenderText_Blended(cardfont, str, red ); letter = TTF_RenderText_Blended(cardfont, str, red );
area.x = CARDFONTX; area.y = CARDFONTY; area.w = 0; area.h = 0; area.x = CARDFONTX; area.y = CARDFONTY; area.w = 0; area.h = 0;
if (i == 10) area.x -= 3; if (i == 10) area.x -= 3;
SDL_BlitSurface(letter, NULL, imageset[P_FIRSTHEART + i-1].img[F_WALK1], &area); SDL_BlitSurface(letter, NULL, imageset[P_FIRSTHEART + i-1].img[F_WALK1], &area);
imageset[P_FIRSTHEART + i-1].numimages = 1; imageset[P_FIRSTHEART + i-1].numimages = 1;
SDL_FreeSurface(letter); SDL_FreeSurface(letter);
// DIAMONDS // DIAMONDS
loadspriteimage(P_FIRSTDIAMOND+i-1, F_WALK1, "sprites/cardd.png"); loadspriteimage(P_FIRSTDIAMOND+i-1, F_WALK1, "sprites/cardd.png");
//sprintf(str, "%s",getcardletter(i)); //sprintf(str, "%s",getcardletter(i));
@ -2001,6 +2051,8 @@ int loadimagesets(void) {
SDL_BlitSurface(letter, NULL, imageset[P_FIRSTDIAMOND + i-1].img[F_WALK1], &area); SDL_BlitSurface(letter, NULL, imageset[P_FIRSTDIAMOND + i-1].img[F_WALK1], &area);
imageset[P_FIRSTDIAMOND + i-1].numimages = 1; imageset[P_FIRSTDIAMOND + i-1].numimages = 1;
SDL_FreeSurface(letter); SDL_FreeSurface(letter);
// SPADES // SPADES
loadspriteimage(P_FIRSTSPADE+i-1, F_WALK1, "sprites/cards.png"); loadspriteimage(P_FIRSTSPADE+i-1, F_WALK1, "sprites/cards.png");
//sprintf(str, "%s",getcardletter(i)); //sprintf(str, "%s",getcardletter(i));
@ -2008,9 +2060,12 @@ int loadimagesets(void) {
letter = TTF_RenderText_Blended(cardfont, str, black ); letter = TTF_RenderText_Blended(cardfont, str, black );
area.x = CARDFONTX; area.y = CARDFONTY; area.w = 0; area.h = 0; area.x = CARDFONTX; area.y = CARDFONTY; area.w = 0; area.h = 0;
if (i == 10) area.x -= 3; if (i == 10) area.x -= 3;
SDL_BlitSurface(letter, NULL, imageset[P_FIRSTSPADE + i-1].img[F_WALK1], &area); SDL_BlitSurface(letter, NULL, imageset[P_FIRSTSPADE + i-1].img[F_WALK1], &area);
imageset[P_FIRSTSPADE + i-1].numimages = 1; imageset[P_FIRSTSPADE + i-1].numimages = 1;
SDL_FreeSurface(letter); SDL_FreeSurface(letter);
// CLUBS // CLUBS
loadspriteimage(P_FIRSTCLUB+i-1, F_WALK1, "sprites/cardc.png"); loadspriteimage(P_FIRSTCLUB+i-1, F_WALK1, "sprites/cardc.png");
//sprintf(str, "%s",getcardletter(i)); //sprintf(str, "%s",getcardletter(i));
@ -2021,6 +2076,7 @@ int loadimagesets(void) {
SDL_BlitSurface(letter, NULL, imageset[P_FIRSTCLUB + i-1].img[F_WALK1], &area); SDL_BlitSurface(letter, NULL, imageset[P_FIRSTCLUB + i-1].img[F_WALK1], &area);
imageset[P_FIRSTCLUB + i-1].numimages = 1; imageset[P_FIRSTCLUB + i-1].numimages = 1;
SDL_FreeSurface(letter); SDL_FreeSurface(letter);
} }
@ -3926,9 +3982,9 @@ int isnettable(sprite_t *s) {
// return starting health for a given boss type // return starting health for a given boss type
int getbosshealth(int mid) { int getbosshealth(int mid) {
if (cheat) { /* if (cheat) {
return 1; return 1;
} } */
switch (mid) { switch (mid) {
case P_KINGRAT: case P_KINGRAT:
return 8; return 8;