diff --git a/data/sprites/armor2.png b/data/sprites/armor2.png new file mode 100644 index 0000000..0dc6163 Binary files /dev/null and b/data/sprites/armor2.png differ diff --git a/data/sprites/armor2climb1.png b/data/sprites/armor2climb1.png new file mode 100644 index 0000000..afbbd65 Binary files /dev/null and b/data/sprites/armor2climb1.png differ diff --git a/data/sprites/armor2climb2.png b/data/sprites/armor2climb2.png new file mode 100644 index 0000000..56670bb Binary files /dev/null and b/data/sprites/armor2climb2.png differ diff --git a/data/sprites/armor2fall.png b/data/sprites/armor2fall.png new file mode 100644 index 0000000..72971be Binary files /dev/null and b/data/sprites/armor2fall.png differ diff --git a/data/sprites/armor2jump.png b/data/sprites/armor2jump.png new file mode 100644 index 0000000..731c080 Binary files /dev/null and b/data/sprites/armor2jump.png differ diff --git a/data/sprites/armor2shoot.png b/data/sprites/armor2shoot.png new file mode 100644 index 0000000..b9c7fe8 Binary files /dev/null and b/data/sprites/armor2shoot.png differ diff --git a/data/sprites/armor2slam1.png b/data/sprites/armor2slam1.png new file mode 100644 index 0000000..e1d5b7d Binary files /dev/null and b/data/sprites/armor2slam1.png differ diff --git a/data/sprites/armor2slam2.png b/data/sprites/armor2slam2.png new file mode 100644 index 0000000..6f90efe Binary files /dev/null and b/data/sprites/armor2slam2.png differ diff --git a/data/sprites/armor2slam3.png b/data/sprites/armor2slam3.png new file mode 100644 index 0000000..5d1d991 Binary files /dev/null and b/data/sprites/armor2slam3.png differ diff --git a/data/sprites/armor2slam4.png b/data/sprites/armor2slam4.png new file mode 100644 index 0000000..4346ad6 Binary files /dev/null and b/data/sprites/armor2slam4.png differ diff --git a/data/sprites/armor2slam5.png b/data/sprites/armor2slam5.png new file mode 100644 index 0000000..0958fea Binary files /dev/null and b/data/sprites/armor2slam5.png differ diff --git a/data/sprites/armor2swim1.png b/data/sprites/armor2swim1.png new file mode 100644 index 0000000..cf6a62f Binary files /dev/null and b/data/sprites/armor2swim1.png differ diff --git a/data/sprites/armor2swim2.png b/data/sprites/armor2swim2.png new file mode 100644 index 0000000..3ba0828 Binary files /dev/null and b/data/sprites/armor2swim2.png differ diff --git a/data/sprites/d2slam5.png b/data/sprites/d2slam5.png index 5c7fe46..555a255 100644 Binary files a/data/sprites/d2slam5.png and b/data/sprites/d2slam5.png differ diff --git a/data/sprites/dwarf2head.png b/data/sprites/dwarf2head.png new file mode 100644 index 0000000..da9a07a Binary files /dev/null and b/data/sprites/dwarf2head.png differ diff --git a/data/sprites/dwarf2head5.png b/data/sprites/dwarf2head5.png new file mode 100644 index 0000000..89fbe87 Binary files /dev/null and b/data/sprites/dwarf2head5.png differ diff --git a/data/sprites/p2dwarfjump.png b/data/sprites/p2dwarfjump.png index 77840a3..64394e4 100644 Binary files a/data/sprites/p2dwarfjump.png and b/data/sprites/p2dwarfjump.png differ diff --git a/defs.h b/defs.h index c1fdbc3..5f19af5 100644 --- a/defs.h +++ b/defs.h @@ -325,7 +325,7 @@ #define S_SLOPE 2 // Sprite types -#define MAXPTYPES 135 +#define MAXPTYPES 136 #define P_PLAYER 0 #define P_RAT 1 #define P_CHEESE 2 @@ -466,6 +466,7 @@ #define P_PLATFORM 132 #define P_FLY 133 #define P_PLAYER2 134 +#define P_ARMOUR2 135 // player 2 wearing armour #define FLY_FLYTIME 150 @@ -882,6 +883,7 @@ imageset_t imageset[MAXPTYPES]; extern char progname[]; extern SDL_Color black; extern SDL_Surface *screen, *temps, *levelbg, *head, *head5, *icecube; +extern SDL_Surface *head2,*head52; extern SDL_Surface *healthbar[]; extern SDL_Surface *greenbox, *redbox; extern sprite_t *sprite, *lastsprite, *player, *player2, *boss; diff --git a/globals.h b/globals.h index f8c1311..b648c08 100644 --- a/globals.h +++ b/globals.h @@ -31,6 +31,7 @@ SDL_Surface *levelbg; // level background image SDL_Surface *temps; // temporary surface SDL_Surface *screen; // the actual video screen SDL_Surface *head,*head5; // imgs in corner showing number of lives +SDL_Surface *head2,*head52; // imgs in corner showing number of lives SDL_Surface *icecube; // overlaid on frozen monsters SDL_Surface *greenbox; // for fly spray effect SDL_Surface *redbox; // for gunner diff --git a/rc.c b/rc.c index fedfc48..8863492 100644 --- a/rc.c +++ b/rc.c @@ -354,7 +354,7 @@ int main (int argc, char **argv) { srand(time(NULL)); } else { // cheat - want1up = B_TRUE; + want1up = B_FALSE; want2up = B_TRUE; } @@ -2445,7 +2445,7 @@ int movesprite(sprite_t *s) { } } else if (s->id == P_MASK) { // mask effect // stay on top of player - if (player->slamming) { + if (s->owner->slamming) { s->y = s->owner->y + MASKOFFSETSLAMY; s->x = s->owner->x + (MASKOFFSETSLAMX*s->owner->dir); } else { @@ -2551,7 +2551,7 @@ int movesprite(sprite_t *s) { } else if (s->owner->powerup == PW_CANNON) { int targx,targy; // try to stay behind player - targx = s->owner->x - (player->dir * 32); + targx = s->owner->x - (s->owner->dir * 32); targy = s->owner->y; if (s->x < targx) { s->x += 2; @@ -3384,7 +3384,8 @@ int movesprite(sprite_t *s) { } else if ((xdiff <= -(TILEW*2)) && (xdiff >= -(TILEW*3))) { /* jump left */ jump(s, -1); - } else if (s->y - player->y <= (TILEH*6)) { + } else if ((player && (s->y - player->y <= (TILEH*6))) || + (player2 && (s->y - player2->y <= (TILEH*6)))) { if ((xdiff >= 0) && (xdiff < (TILEW*2))) { /* jump up */ jump(s, 0); @@ -4992,25 +4993,25 @@ void drawscore(void) { // go left correct amount numtoshow2 = numtoshow; while (numtoshow2 >= 5) { - area.x -= (head->w + 3); + area.x -= (head2->w + 3); numtoshow2 -= 5; } for (i = 0; i < numtoshow2; i++) { - area.x -= (head->w + 3); + area.x -= (head2->w + 3); } // now start displaying // show "x5" for lots of lives while (numtoshow >= 5) { - SDL_BlitSurface(head5, NULL, screen, &area); - area.x += (head->w + 3); + SDL_BlitSurface(head52, NULL, screen, &area); + area.x += (head2->w + 3); numtoshow -= 5; } for (i = 0; i < numtoshow; i++) { - SDL_BlitSurface(head, NULL, screen, &area); - area.x += (head->w + 3); + SDL_BlitSurface(head2, NULL, screen, &area); + area.x += (head2->w + 3); } @@ -5610,7 +5611,6 @@ void dogravity(sprite_t *s) { if (s->id == P_PINKCLOUD) return; -if (s->id == P_TICK) printf("9 dogravity for tick\n"); // only player can move if you have a clock if (globpowerup == PW_CLOCK) { if (!iseffect(s->id) && (!isplayer(s)) && !s->caughtby && !s->dead) { @@ -5645,7 +5645,6 @@ if (s->id == P_TICK) printf("9 dogravity for tick\n"); } -if (s->id == P_TICK) printf("0 dogravity for tick\n"); if (s->dead) return; if (s->flies && !s->iced) return; // no gravity if you fly, but ice cancels flying if (s->id != P_KSSHELL) { @@ -5733,7 +5732,7 @@ if (s->id == P_TICK) printf("0 dogravity for tick\n"); // get rid of the mask for (ms = sprite; ms ; ms = ms->next) { if ((ms->id == P_MASK) && (ms->owner == s)) { - s->dead = D_FINAL; + ms->dead = D_FINAL; break; } } @@ -5834,8 +5833,7 @@ if (s->id == P_TICK) printf("0 dogravity for tick\n"); } if ((s->id == P_KINGRAT) && (s->timer1 == KRS_FALL)) { // special case // king rat drops until he is at player height - // TODO: 2player - if ((player->dead) || (s->y < player->y)) { // above player + if (!playersalive() || isplayerbelow(s)) { // above player ontheground = B_FALSE; } else { // above player s->dropping = B_FALSE; @@ -6473,8 +6471,11 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) { } else if (s->id == P_HELMET) { int xx,yy; playfx(FX_ARMOR); - // TODO: player2 - pp->id = P_ARMOUR; // change how the player looks + if (pp == player) { + pp->id = P_ARMOUR; // change how the player looks + } else { + pp->id = P_ARMOUR2; // change how the player looks + } pp->armour = B_TRUE; sprintf(tempm, "Armour!"); addoutlinetext(s->x,s->y - s->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY, TT_NORM); @@ -6783,14 +6784,15 @@ int dofruiteffect(sprite_t *pp, sprite_t *s) { gunorigy = pp->y; guntime = 10; gundelay = 0; // used to control shooting speed + pp->powerup = PW_GUNNER; // turn off netting etc - player->netting = B_FALSE; - player->slamming = B_FALSE; - player->powerup = PW_GUNNER; + if (player) { + player->netting = B_FALSE; + player->slamming = B_FALSE; + } if (player2) { player2->netting = B_FALSE; player2->slamming = B_FALSE; - player2->powerup = PW_GUNNER; } return B_TRUE; @@ -9466,7 +9468,7 @@ void startgame(void) { if (gamemode == GM_EASY) { player2->permarmour = B_TRUE; player2->armour = B_TRUE; - player2->id = P_ARMOUR; + player2->id = P_ARMOUR2; } else { player2->permarmour = B_FALSE; player2->armour = B_FALSE; diff --git a/shared.c b/shared.c index d2608bc..1df5f28 100644 --- a/shared.c +++ b/shared.c @@ -644,7 +644,11 @@ void setdefaults(sprite_t *s) { if (s->permarmour) { s->armour = B_TRUE; - s->id = P_ARMOUR; + if (s == player) { + s->id = P_ARMOUR; + } else { + s->id = P_ARMOUR2; + } } else { s->armour = B_FALSE; } @@ -1106,6 +1110,10 @@ int loadimagesets(void) { head = IMG_Load(tempfile); sprintf(tempfile, "%s/sprites/dwarfhead5.png",datadir); head5 = IMG_Load(tempfile); + sprintf(tempfile, "%s/sprites/dwarf2head.png",datadir); + head2 = IMG_Load(tempfile); + sprintf(tempfile, "%s/sprites/dwarf2head5.png",datadir); + head52 = IMG_Load(tempfile); sprintf(tempfile, "%s/sprites/icecube.png",datadir); icecube = IMG_Load(tempfile); @@ -1189,6 +1197,24 @@ int loadimagesets(void) { loadspriteimage(P_ARMOUR,F_SWIM2, "sprites/armorswim2.png"); imageset[P_ARMOUR].numimages = 18; + loadspriteimage(P_ARMOUR2,F_WALK1, "sprites/armor2.png"); + loadspriteimage(P_ARMOUR2,F_JUMP, "sprites/armor2jump.png"); + loadspriteimage(P_ARMOUR2,F_FALL, "sprites/armor2fall.png"); + loadspriteimage(P_ARMOUR2,F_CAUGHT, "sprites/armor2.png"); + loadspriteimage(P_ARMOUR2,F_DEAD, "sprites/dwarfdie.png"); // not used + /* next 3 are auto generated */ + loadspriteimage(P_ARMOUR2,F_CLIMB1, "sprites/armor2climb1.png"); + loadspriteimage(P_ARMOUR2,F_CLIMB2, "sprites/armor2climb2.png"); + loadspriteimage(P_ARMOUR2,F_SHOOT, "sprites/armor2shoot.png"); + loadspriteimage(P_ARMOUR2,F_SLAM1, "sprites/armor2slam1.png"); + loadspriteimage(P_ARMOUR2,F_SLAM2, "sprites/armor2slam2.png"); + loadspriteimage(P_ARMOUR2,F_SLAM3, "sprites/armor2slam3.png"); + loadspriteimage(P_ARMOUR2,F_SLAM4, "sprites/armor2slam4.png"); + loadspriteimage(P_ARMOUR2,F_SLAM5, "sprites/armor2slam5.png"); + loadspriteimage(P_ARMOUR2,F_SWIM1, "sprites/armor2swim1.png"); + loadspriteimage(P_ARMOUR2,F_SWIM2, "sprites/armor2swim2.png"); + imageset[P_ARMOUR2].numimages = 18; + loadspriteimage(P_SNAKE,F_WALK1, "sprites/snake.png"); loadspriteimage(P_SNAKE,F_JUMP, "sprites/snakejump.png"); @@ -2928,6 +2954,8 @@ int randompowerup(void) { int num; num = rand() % 34; +return P_MASKPOWERUP; + switch (num) { case 0: default: