Fixed bug with slamming a monster off the side of the screen

This commit is contained in:
Rob Pearce 2008-09-28 05:02:30 +00:00
parent f490e145f4
commit f1962993b2
4 changed files with 23 additions and 7 deletions

9
defs.h
View File

@ -6,12 +6,13 @@
/* Macros */ /* Macros */
//#define OPENGL //#define OPENGL
// channel numbers // sound channel numbers
#define CH_LASTCHANNEL 21 #define CH_LASTCHANNEL 21
#define CH_HURRYUP 20 #define CH_HURRYUP 20
// size of flower straem when getting last flower // size of flower straem when getting last flower
// (number of gems on each side) // (number of gems on each side)
#define STREAMWID 6 #define STREAMWID 6
@ -39,6 +40,10 @@
#define HELPDELAY 80 #define HELPDELAY 80
//
#define POWERUPTIME 15 // # secs before a powerup appears
// Sizes // Sizes
#define TILEH 16 // tile width (in pixels) #define TILEH 16 // tile width (in pixels)
#define TILEW 16 // tile height (in pixels) #define TILEW 16 // tile height (in pixels)

BIN
rc

Binary file not shown.

19
rc.c
View File

@ -865,7 +865,6 @@ void movesprite(sprite_t *s) {
if (s->caughtby) { if (s->caughtby) {
if (s->caughtby->slamming) { if (s->caughtby->slamming) {
/* */ /* */
s->x = s->caughtby->netxstart; s->x = s->caughtby->netxstart;
@ -2341,8 +2340,20 @@ void dogravity(sprite_t *s) {
} }
if (s->slamming) { if (s->slamming) {
int netx;
double dist;
int hitwall = B_FALSE;
s->slamangle += (10 * (M_PI/180)); s->slamangle += (10 * (M_PI/180));
if (s->slamangle >= (180 * (M_PI/180))) {
dist = (s->slamangle * (180/M_PI))/2;
netx = s->x + cos(s->slamangle-(180*(M_PI/180)))*dist*s->dir;
if ((netx >= (640-TILEW)) || (netx <= TILEW)) {
hitwall = B_TRUE;
}
if (s->slamangle >= (180 * (M_PI/180)) || hitwall) {
/* finished slamming */ /* finished slamming */
int xdiff,ydiff,xnet = 0,ynet = 0; int xdiff,ydiff,xnet = 0,ynet = 0;
int pointsinc = 250; int pointsinc = 250;
@ -2360,8 +2371,8 @@ void dogravity(sprite_t *s) {
if (s2->caughtby == s) { if (s2->caughtby == s) {
tiletype_t *tt; tiletype_t *tt;
tt = gettileat(s2->x,s2->y+2,NULL,NULL); tt = gettileat(s2->x,s2->y+2,NULL,NULL);
/* if on ground, monster dies */ /* if on ground or hitting a wall, monster dies */
if ((tt == NULL) || (tt->solid)) { if ((hitwall) || (tt == NULL) || (tt->solid)) {
/* will become a fruit when it finishes dying */ /* will become a fruit when it finishes dying */
s2->willbecome = fruittypes[curfruittype]; s2->willbecome = fruittypes[curfruittype];
/* increment fruit type */ /* increment fruit type */

View File

@ -66,7 +66,7 @@ int loadlevel(int wnum, int lnum) {
/* default */ /* default */
level->hurryuptime = 30; level->hurryuptime = 30;
level->poweruptime = 5; level->poweruptime = POWERUPTIME;
level->p1x = 0; level->p1x = 0;
level->p1y = 0; level->p1y = 0;
level->powerupx = -1; level->powerupx = -1;