- updated earth.cpp and fireball.cpp to 8.4 CK Code
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@201 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "../include/enemyai.h"
|
||||
|
||||
#include "earth.h"
|
||||
|
||||
// explosion and earth chunk objects, used for the "earth explodes"
|
||||
// sequence when you press the switch on a Tantalus Ray in ep2.
|
||||
|
||||
@@ -26,7 +28,7 @@ void explosion_ai(int o)
|
||||
{
|
||||
if (objects[o].ai.ray.direction==-1 && objects[o].ai.ray.animframe==0)
|
||||
{
|
||||
objects[o].exists = 0;
|
||||
delete_object(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -55,7 +57,7 @@ void earthchunk_ai(int o)
|
||||
objects[o].inhibitfall = 1;
|
||||
objects[o].needinit = 0;
|
||||
}
|
||||
if (!objects[o].onscreen) objects[o].exists = 0;
|
||||
if (!objects[o].onscreen) delete_object(o);
|
||||
|
||||
switch(objects[o].ai.ray.direction)
|
||||
{
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
#include "../include/enemyai.h"
|
||||
|
||||
#include "../sdl/sound/CSound.h"
|
||||
#include "fireball.h"
|
||||
|
||||
// fireball projectile shot out by Vorticon Mother (Ep3)
|
||||
|
||||
#define FIREBALL_SPEED 5
|
||||
|
||||
#define FIREBALL_SPEED 8
|
||||
#define FIREBALL_HARD_SPEED 19
|
||||
#define FIREBALL_ANIM_RATE 80
|
||||
|
||||
#define FIREBALL_LEFT_FRAME 57
|
||||
@@ -17,9 +18,10 @@
|
||||
|
||||
#define FIREBALL_OFFSCREEN_KILL_TIME 100
|
||||
|
||||
void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
void fireball_ai(int o, bool hard)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
int speed;
|
||||
if (objects[o].needinit)
|
||||
{
|
||||
objects[o].ai.ray.animframe = 0;
|
||||
@@ -30,36 +32,43 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
objects[o].needinit = 0;
|
||||
}
|
||||
|
||||
// test if it hit a baddie
|
||||
for(i=1;i<MAX_OBJECTS;i++)
|
||||
{
|
||||
if (!objects[i].exists || i==o) continue;
|
||||
if (objects[o].ai.ray.dontHitEnable)
|
||||
{
|
||||
if (objects[i].type==objects[o].ai.ray.dontHit) continue;
|
||||
}
|
||||
|
||||
if (objects[i].canbezapped && objects[i].type != OBJ_MOTHER)
|
||||
{
|
||||
if (hitdetect(i, o))
|
||||
{
|
||||
objects[o].type = OBJ_RAY;
|
||||
objects[o].ai.ray.state = RAY_STATE_SETZAPZOT;
|
||||
objects[i].zapped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if it hit keen
|
||||
if (objects[o].touchPlayer)
|
||||
{
|
||||
killplayer(objects[o].touchedBy);
|
||||
// make a ZAP-ZOT animation
|
||||
objects[o].type = OBJ_RAY;
|
||||
objects[o].ai.ray.state = RAY_STATE_SETZAPZOT;
|
||||
objects[o].inhibitfall = 1;
|
||||
objects[o].needinit = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// test if it hit a baddie
|
||||
//for(i=1;i<highest_objslot;i++)
|
||||
for(i=1;i<MAX_OBJECTS;i++) // TODO: Must be replaced by the upper when highest_objslot is in existence
|
||||
{
|
||||
if (!objects[i].exists || i==o) continue;
|
||||
if (objects[i].type==OBJ_RAY || objects[i].type==OBJ_FIREBALL) continue;
|
||||
|
||||
if (objects[i].canbezapped)
|
||||
{
|
||||
if (hitdetect(i, o))
|
||||
{
|
||||
objects[o].type = OBJ_RAY;
|
||||
objects[o].ai.ray.state = RAY_STATE_SETZAPZOT;
|
||||
objects[o].inhibitfall = 1;
|
||||
objects[o].needinit = 0;
|
||||
objects[i].zapped++;
|
||||
objects[i].zapx = objects[o].x;
|
||||
objects[i].zapy = objects[o].y;
|
||||
objects[i].zapd = objects[o].ai.ray.direction;
|
||||
objects[i].zappedbyenemy = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check if it was shot
|
||||
if (objects[o].zapped)
|
||||
{
|
||||
@@ -79,7 +88,7 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
{
|
||||
if (objects[o].ai.ray.offscreentime > FIREBALL_OFFSCREEN_KILL_TIME)
|
||||
{
|
||||
objects[o].exists = 0;
|
||||
delete_object(o);
|
||||
return;
|
||||
}
|
||||
else objects[o].ai.ray.offscreentime++;
|
||||
@@ -87,6 +96,7 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
else objects[o].ai.ray.offscreentime = 0;
|
||||
|
||||
// fly through the air
|
||||
speed = hard ? FIREBALL_HARD_SPEED : FIREBALL_SPEED;
|
||||
if (objects[o].ai.ray.direction == RIGHT)
|
||||
{
|
||||
objects[o].sprite = FIREBALL_RIGHT_FRAME + objects[o].ai.ray.animframe;
|
||||
@@ -98,7 +108,7 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
objects[o].needinit = 0;
|
||||
return;
|
||||
}
|
||||
else objects[o].x += FIREBALL_SPEED;
|
||||
else objects[o].x += speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -111,7 +121,7 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
objects[o].needinit = 0;
|
||||
return;
|
||||
}
|
||||
else objects[o].x -= FIREBALL_SPEED;
|
||||
else objects[o].x -= speed;
|
||||
}
|
||||
|
||||
// animation
|
||||
@@ -123,3 +133,5 @@ void fireball_ai(int o, stCloneKeenPlus *pCKP)
|
||||
else objects[o].ai.ray.animtimer++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ int i;
|
||||
case OBJ_MEEP: meep_ai(i, pCKP->Control.levelcontrol); break;
|
||||
case OBJ_SNDWAVE: sndwave_ai(i, pCKP); break;
|
||||
case OBJ_MOTHER: mother_ai(i, pCKP->Control.levelcontrol); break;
|
||||
case OBJ_FIREBALL: fireball_ai(i, pCKP); break;
|
||||
case OBJ_FIREBALL: fireball_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
||||
case OBJ_BALL: ballandjack_ai(i); break;
|
||||
case OBJ_JACK: ballandjack_ai(i); break;
|
||||
case OBJ_PLATVERT: platvert_ai(i); break;
|
||||
|
||||
@@ -32,7 +32,7 @@ void ninja_ai(int o, stCloneKeenPlus *pCKP);
|
||||
void meep_ai(int o, stLevelControl levelcontrol);
|
||||
void sndwave_ai(int o, stCloneKeenPlus *pCKP);
|
||||
void mother_ai(int o, stLevelControl levelcontrol);
|
||||
void fireball_ai(int o, stCloneKeenPlus *pCKP);
|
||||
void fireball_ai(int o, bool hard);
|
||||
void ballandjack_ai(int o);
|
||||
void platvert_ai(int o);
|
||||
void nessie_ai(int o);
|
||||
|
||||
Reference in New Issue
Block a user